Clean up use of MockitoAnnotations.initMocks
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / persistence / LocalSnapshotStoreTest.java
index 417a9db7eaa18deab97a8ca2ec5b4c40350dfb07..8531501fa2f0c027d322d0ecc8570accd1d939b5 100644 (file)
@@ -27,7 +27,7 @@ import akka.persistence.SnapshotProtocol.LoadSnapshotResult;
 import akka.persistence.SnapshotSelectionCriteria;
 import akka.persistence.serialization.Snapshot;
 import akka.persistence.serialization.SnapshotSerializer;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -42,7 +42,8 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.mockito.MockitoAnnotations;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
 import scala.Option;
 
 /**
@@ -51,6 +52,7 @@ import scala.Option;
  *
  * @author Thomas Pantelis
  */
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class LocalSnapshotStoreTest {
     private static final String PERSISTENCE_ID = "member-1-shard-default-config";
     private static final String PREFIX_BASED_SHARD_PERSISTENCE_ID = "member-1-shard-id-ints!-config";
@@ -63,18 +65,17 @@ public class LocalSnapshotStoreTest {
         createSnapshotDir();
 
         system = ActorSystem.create("test", ConfigFactory.load("LocalSnapshotStoreTest.conf"));
-        snapshotStore = system.registerExtension(Persistence.lookup()).snapshotStoreFor(null);
+        snapshotStore = system.registerExtension(Persistence.lookup()).snapshotStoreFor(null, ConfigFactory.empty());
     }
 
     @AfterClass
     public static void staticCleanup() {
         FileUtils.deleteQuietly(SNAPSHOT_DIR);
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Before
     public void setup() {
-        MockitoAnnotations.initMocks(this);
         cleanSnapshotDir();
     }
 
@@ -100,7 +101,7 @@ public class LocalSnapshotStoreTest {
 
         SnapshotMetadata metadata3 = new SnapshotMetadata(PERSISTENCE_ID, 1, 3000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@@ -123,8 +124,8 @@ public class LocalSnapshotStoreTest {
     }
 
     @Test
-    public void testDoLoadAsyncWithNoSnapshots() throws IOException {
-        JavaTestKit probe = new JavaTestKit(system);
+    public void testDoLoadAsyncWithNoSnapshots() {
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@@ -140,7 +141,7 @@ public class LocalSnapshotStoreTest {
 
         SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 0, 1000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@@ -156,7 +157,7 @@ public class LocalSnapshotStoreTest {
     public void testDoLoadAsyncWithFailure() throws Throwable {
         createSnapshotFile(PERSISTENCE_ID, null, 1, 2000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new SnapshotProtocol.LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotFailed failed = probe.expectMsgClass(LoadSnapshotFailed.class);
@@ -174,7 +175,7 @@ public class LocalSnapshotStoreTest {
 
         SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 1, 1000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);