Propagate @Nonnull and @Nullable annotations
[yangtools.git] / common / util / src / test / java / org / opendaylight / yangtools / util / concurrent / AsyncNotifyingListeningExecutorServiceTest.java
index 1a3bf0d4fd702879016c0d05e25168d96e6c7e9b..bfc9303561f6000880e8e2cc646dd6bf35e4eadd 100644 (file)
@@ -11,32 +11,29 @@ 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 javax.annotation.Nonnull;
 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 +47,11 @@ public class AsyncNotifyingListeningExecutorServiceTest {
 
     @After
     public void tearDown() {
-        iflistenerExecutor != null ) {
+        if (listenerExecutor != null ) {
             listenerExecutor.shutdownNow();
         }
 
-        iftestExecutor != null ) {
+        if (testExecutor != null ) {
             testExecutor.shutdownNow();
         }
     }
@@ -113,7 +110,7 @@ public class AsyncNotifyingListeningExecutorServiceTest {
         assertTrue( "ListenableFuture callback was not notified of onSuccess",
                     futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) );
 
-        ifassertError.get() != null ) {
+        if (assertError.get() != null ) {
             throw assertError.get();
         }
 
@@ -126,7 +123,7 @@ public class AsyncNotifyingListeningExecutorServiceTest {
         assertTrue( "ListenableFuture callback was not notified of onSuccess",
                     futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) );
 
-        ifassertError.get() != null ) {
+        if (assertError.get() != null ) {
             throw assertError.get();
         }
     }
@@ -154,7 +151,7 @@ public class AsyncNotifyingListeningExecutorServiceTest {
             }
 
             @Override
-            public void onFailure( Throwable t ) {
+            public void onFailure( @Nonnull Throwable t ) {
                 // Shouldn't happen
                 t.printStackTrace();
             }
@@ -164,10 +161,7 @@ public class AsyncNotifyingListeningExecutorServiceTest {
     @Test
     public void testDelegatedMethods() throws InterruptedException {
 
-        Runnable task = new Runnable() {
-            @Override
-            public void run(){
-            }
+        Runnable task = () -> {
         };
 
         List<Runnable> taskList = Lists.newArrayList();