X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Futil%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Futil%2Fconcurrent%2FAsyncNotifyingListeningExecutorServiceTest.java;h=83451004f824a0b7edc89e8961e17b0388ce32e2;hb=a84f141fe3633d5380ca1fb8b41afc4cd770dcfd;hp=1a3bf0d4fd702879016c0d05e25168d96e6c7e9b;hpb=c5e58b6841e2f9d9bcd7808d4f3073b1c4792d26;p=yangtools.git diff --git a/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/AsyncNotifyingListeningExecutorServiceTest.java b/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/AsyncNotifyingListeningExecutorServiceTest.java index 1a3bf0d4fd..83451004f8 100644 --- a/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/AsyncNotifyingListeningExecutorServiceTest.java +++ b/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/AsyncNotifyingListeningExecutorServiceTest.java @@ -11,32 +11,28 @@ package org.opendaylight.yangtools.util.concurrent; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_CALLABLE; +import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_RUNNABLE; +import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_RUNNABLE_WITH_RESULT; +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; - import org.junit.After; import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; - -import com.google.common.collect.Lists; -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ThreadFactoryBuilder; - -import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.Invoker; -import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_CALLABLE; -import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_RUNNABLE; -import static org.opendaylight.yangtools.util.concurrent.CommonTestUtils.SUBMIT_RUNNABLE_WITH_RESULT; +import org.opendaylight.yangtools.util.concurrent.CommonTestUtils.Invoker; /** * Unit tests for AsyncNotifyingListeningExecutorService. @@ -50,11 +46,11 @@ public class AsyncNotifyingListeningExecutorServiceTest { @After public void tearDown() { - if( listenerExecutor != null ) { + if (listenerExecutor != null ) { listenerExecutor.shutdownNow(); } - if( testExecutor != null ) { + if (testExecutor != null ) { testExecutor.shutdownNow(); } } @@ -113,7 +109,7 @@ public class AsyncNotifyingListeningExecutorServiceTest { assertTrue( "ListenableFuture callback was not notified of onSuccess", futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) ); - if( assertError.get() != null ) { + if (assertError.get() != null ) { throw assertError.get(); } @@ -126,7 +122,7 @@ public class AsyncNotifyingListeningExecutorServiceTest { assertTrue( "ListenableFuture callback was not notified of onSuccess", futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) ); - if( assertError.get() != null ) { + if (assertError.get() != null ) { throw assertError.get(); } } @@ -164,10 +160,7 @@ public class AsyncNotifyingListeningExecutorServiceTest { @Test public void testDelegatedMethods() throws InterruptedException { - Runnable task = new Runnable() { - @Override - public void run(){ - } + Runnable task = () -> { }; List taskList = Lists.newArrayList();