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.
@After
public void tearDown() {
- if( listenerExecutor != null ) {
+ if (listenerExecutor != null ) {
listenerExecutor.shutdownNow();
}
- if( testExecutor != null ) {
+ if (testExecutor != null ) {
testExecutor.shutdownNow();
}
}
assertTrue( "ListenableFuture callback was not notified of onSuccess",
futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) );
- if( assertError.get() != null ) {
+ if (assertError.get() != null ) {
throw assertError.get();
}
assertTrue( "ListenableFuture callback was not notified of onSuccess",
futureNotifiedLatch.await( 5, TimeUnit.SECONDS ) );
- if( assertError.get() != null ) {
+ if (assertError.get() != null ) {
throw assertError.get();
}
}
}
@Override
- public void onFailure( Throwable t ) {
+ public void onFailure( @Nonnull Throwable t ) {
// Shouldn't happen
t.printStackTrace();
}
@Test
public void testDelegatedMethods() throws InterruptedException {
- Runnable task = new Runnable() {
- @Override
- public void run(){
- }
+ Runnable task = () -> {
};
List<Runnable> taskList = Lists.newArrayList();