Radutamas/bael 1265 update junit with lambdas (#3196)
* Code for test article: Different Types of Bean Injection in Spring * Adding jUnits for test article: Different Types of Bean Injection in Spring * BAEL-1265: Adding jUnit for article * BAEL-1265: Closing ExecutorService in jUnit * BAEL-1265: Using lambdas instead of anonymous classes
This commit is contained in:
parent
93fc61750e
commit
d562f429a1
|
@ -9,7 +9,6 @@ import java.util.List;
|
|||
import java.util.concurrent.*;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class WaitingForThreadsToFinishTest {
|
||||
|
||||
|
@ -40,9 +39,7 @@ public class WaitingForThreadsToFinishTest {
|
|||
CountDownLatch latch = new CountDownLatch(2);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
WORKER_THREAD_POOL.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WORKER_THREAD_POOL.submit(() -> {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
latch.countDown();
|
||||
|
@ -50,7 +47,6 @@ public class WaitingForThreadsToFinishTest {
|
|||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,13 +79,9 @@ public class WaitingForThreadsToFinishTest {
|
|||
awaitTerminationAfterShutdown(WORKER_THREAD_POOL);
|
||||
|
||||
try {
|
||||
WORKER_THREAD_POOL.submit(new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
fail("This thread should have been rejected !");
|
||||
WORKER_THREAD_POOL.submit((Callable<String>) () -> {
|
||||
Thread.sleep(1000000);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException ex) {
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue