mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-25 00:09:02 +00:00
Consistently throw Task/InvocationRejectedException on access rejected
Closes gh-36167
This commit is contained in:
+2
-5
@@ -21,12 +21,9 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.util.ConcurrencyThrottleSupport;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.willCallRealMethod;
|
||||
@@ -61,9 +58,9 @@ class SimpleAsyncTaskExecutorTests {
|
||||
@Test
|
||||
void cannotExecuteWhenConcurrencyIsSwitchedOff() {
|
||||
try (SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor()) {
|
||||
executor.setConcurrencyLimit(ConcurrencyThrottleSupport.NO_CONCURRENCY);
|
||||
executor.setConcurrencyLimit(SimpleAsyncTaskExecutor.NO_CONCURRENCY);
|
||||
assertThat(executor.isThrottleActive()).isTrue();
|
||||
assertThatIllegalStateException().isThrownBy(() -> executor.execute(new NoOpRunnable()));
|
||||
assertThatExceptionOfType(TaskRejectedException.class).isThrownBy(() -> executor.execute(new NoOpRunnable()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user