Moved the testcase to core-java-jvm module

This commit is contained in:
musibs 2020-06-02 17:58:52 +05:30
parent ce8d289cd9
commit 4998662d45

View File

@ -12,7 +12,7 @@ import java.util.stream.IntStream;
import org.junit.jupiter.api.Test;
public class TestExecutorService {
public class ExecutorServiceUnitTest {
@Test
public void givenAnExecutorService_WhenMoreTasksSubmitted_ThenAdditionalTasksWait() {
@ -34,6 +34,22 @@ public class TestExecutorService {
.forEach(i -> executorService.submit(runnableTask));
// Then
assertThat(((ThreadPoolExecutor )executorService).getQueue().size(), is(equalTo(5)));
assertThat(((ThreadPoolExecutor) executorService).getQueue()
.size(), is(equalTo(5)));
}
@Test
public void givenAnExecutorService() throws Exception {
while (true) {
TimeUnit.SECONDS.sleep(5);
new Thread(() -> {
try {
TimeUnit.HOURS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
}
}