Revert "Add mockito-configuration to tests" 18/32818/2
authorRobert Varga <nite@hq.sk>
Fri, 15 Jan 2016 12:20:32 +0000 (12:20 +0000)
committerRobert Varga <nite@hq.sk>
Mon, 18 Jan 2016 13:09:41 +0000 (13:09 +0000)
This reverts commit dcc92fc8fdf056d5ada94931f2d24523070fd9a7.

Change-Id: Ia89b88f9b933d31d369e5ad75ebf8c762c9dfde0
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
13 files changed:
opendaylight/md-sal/sal-akka-raft/pom.xml
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ElectionTermImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActor.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorDelegatingPersistentDataProviderTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorLeadershipTransferCohortTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorSnapshotMessageSupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotManagerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java

index 6324d7d..7049509 100644 (file)
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>mockito-configuration</artifactId>
-      <scope>test</scope>
-    </dependency>
 
     <dependency>
       <groupId>org.slf4j</groupId>
index a7d2f48..9dd5e40 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.controller.cluster.raft;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.verify;
 import akka.japi.Procedure;
 import org.junit.Before;
@@ -17,8 +15,6 @@ import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm;
 import org.slf4j.Logger;
@@ -35,19 +31,9 @@ public class ElectionTermImplTest {
     @Mock
     private DataPersistenceProvider mockPersistence;
 
-    @SuppressWarnings("unchecked")
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
-
-        doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Exception {
-                final Object[] args = invocation.getArguments();
-                ((Procedure<Object>)args[1]).apply(args[0]);
-                return null;
-            }
-        }).when(mockPersistence).persist(any(Object.class), any(Procedure.class));
     }
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
index 7411245..c1a87e8 100644 (file)
@@ -9,8 +9,6 @@
 package org.opendaylight.controller.cluster.raft;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 import akka.actor.ActorRef;
 import akka.actor.Props;
@@ -51,16 +49,8 @@ public class MockRaftActor extends RaftActor implements RaftActorRecoveryCohort,
         super(builder.id, builder.peerAddresses, Optional.fromNullable(builder.config), PAYLOAD_VERSION);
         state = new ArrayList<>();
         this.actorDelegate = mock(RaftActor.class);
-        doNothing().when(this.actorDelegate).onRecoveryComplete();
-        doNothing().when(this.actorDelegate).onStateChanged();
-        doNothing().when(this.actorDelegate).applyState(any(ActorRef.class), any(String.class), any(Object.class));
-
         this.recoveryCohortDelegate = mock(RaftActorRecoveryCohort.class);
-        doNothing().when(this.recoveryCohortDelegate).applyRecoverySnapshot(any(byte[].class));
-
         this.snapshotCohortDelegate = mock(RaftActorSnapshotCohort.class);
-        doNothing().when(this.snapshotCohortDelegate).applySnapshot(any(byte[].class));
-        doNothing().when(this.snapshotCohortDelegate).createSnapshot(any(ActorRef.class));
 
         if(builder.dataPersistenceProvider == null){
             setPersistence(builder.persistent.isPresent() ? builder.persistent.get() : true);
index e833f43..378c53c 100644 (file)
@@ -7,9 +7,6 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import akka.japi.Procedure;
@@ -19,8 +16,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.PersistentDataProvider;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
@@ -56,24 +51,11 @@ public class RaftActorDelegatingPersistentDataProviderTest {
 
     private RaftActorDelegatingPersistentDataProvider provider;
 
-    @SuppressWarnings("unchecked")
     @Before
-    public void setup() throws Exception {
+    public void setup() {
         MockitoAnnotations.initMocks(this);
         doReturn(PERSISTENT_PAYLOAD).when(mockPersistentLogEntry).getData();
         doReturn(NON_PERSISTENT_PAYLOAD).when(mockNonPersistentLogEntry).getData();
-
-        doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Exception {
-                final Object[] args = invocation.getArguments();
-                ((Procedure<Object>)args[1]).apply(args[0]);
-                return null;
-            }
-        }).when(mockPersistentProvider).persist(any(Object.class), any(Procedure.class));
-
-        doNothing().when(mockDelegateProvider).persist(any(Object.class), any(Procedure.class));
-        doNothing().when(mockProcedure).apply(any(Object.class));
         provider = new RaftActorDelegatingPersistentDataProvider(mockDelegateProvider, mockPersistentProvider);
     }
 
index 9037f68..c7d9e3d 100644 (file)
@@ -7,13 +7,10 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.timeout;
 import static org.mockito.Mockito.verify;
-import akka.actor.ActorRef;
 import akka.dispatch.Dispatchers;
 import com.google.common.base.Function;
 import org.junit.After;
@@ -39,9 +36,6 @@ public class RaftActorLeadershipTransferCohortTest extends AbstractActorTest {
     }
 
     private void setup() {
-        doNothing().when(onComplete).onSuccess(any(ActorRef.class), any(ActorRef.class));
-        doNothing().when(onComplete).onFailure(any(ActorRef.class), any(ActorRef.class));
-
         String persistenceId = factory.generateActorId("leader-");
         mockRaftActor = factory.<MockRaftActor>createTestActor(MockRaftActor.builder().id(persistenceId).config(
                 config).pauseLeaderFunction(pauseLeaderFunction).props().withDispatcher(Dispatchers.DefaultDispatcherId()),
index 2c13031..71ca4ca 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyInt;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
@@ -78,20 +77,13 @@ public class RaftActorRecoverySupportTest {
     public void setup() {
         MockitoAnnotations.initMocks(this);
 
-        doNothing().when(mockCohort).startLogRecoveryBatch(any(int.class));
-        doNothing().when(mockCohort).applyCurrentLogRecoveryBatch();
-        doNothing().when(mockCohort).applyRecoverySnapshot(any(byte[].class));
-        doNothing().when(mockCohort).appendRecoveredLogEntry(any(Payload.class));
-        doReturn(null).when(mockCohort).getRestoreFromSnapshot();
-        doReturn(true).when(mockPersistence).isRecoveryApplicable();
-        doNothing().when(mockPersistence).deleteMessages(any(long.class));
-        doNothing().when(mockPersistentProvider).deleteMessages(any(long.class));
-        doNothing().when(mockPersistentProvider).deleteSnapshots(any(SnapshotSelectionCriteria.class));
-        doNothing().when(mockPersistentProvider).persist(any(Object.class), any(Procedure.class));
-
         context = new RaftActorContextImpl(null, null, localId, new ElectionTermImpl(mockPersistentProvider, "test", LOG),
                 -1, -1, Collections.<String,String>emptyMap(), configParams, mockPersistence, LOG);
+
         support = new RaftActorRecoverySupport(context, mockBehavior , mockCohort);
+
+        doReturn(true).when(mockPersistence).isRecoveryApplicable();
+
         context.setReplicatedLog(ReplicatedLogImpl.newInstance(context, mockBehavior));
     }
 
index d9dcd06..94000d0 100644 (file)
@@ -11,12 +11,9 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.anyLong;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Matchers.same;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import akka.actor.ActorRef;
-import akka.japi.Procedure;
 import akka.persistence.SaveSnapshotFailure;
 import akka.persistence.SaveSnapshotSuccess;
 import akka.persistence.SnapshotMetadata;
@@ -65,13 +62,6 @@ public class RaftActorSnapshotMessageSupportTest {
     public void setup() {
         MockitoAnnotations.initMocks(this);
 
-        doNothing().when(mockSnapshotManager).setApplySnapshotProcedure(any(Procedure.class));
-        doNothing().when(mockSnapshotManager).setCreateSnapshotCallable(any(Procedure.class));
-        doNothing().when(mockSnapshotManager).apply(any(ApplySnapshot.class));
-        doNothing().when(mockSnapshotManager).commit(any(long.class), any(RaftActorBehavior.class));
-        doNothing().when(mockSnapshotManager).persist(any(byte[].class), any(RaftActorBehavior.class), any(long.class));
-        doNothing().when(mockSnapshotManager).rollback();
-
         context = new RaftActorContextImpl(mockRaftActorRef, null, "test",
                 new ElectionTermImpl(mockPersistence, "test", LOG),
                 -1, -1, Collections.<String,String>emptyMap(), configParams, mockPersistence, LOG) {
index c47ca5c..f4846d2 100644 (file)
@@ -19,7 +19,6 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Matchers.same;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -37,7 +36,6 @@ import akka.persistence.SaveSnapshotFailure;
 import akka.persistence.SaveSnapshotSuccess;
 import akka.persistence.SnapshotMetadata;
 import akka.persistence.SnapshotOffer;
-import akka.persistence.SnapshotSelectionCriteria;
 import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
 import com.google.common.base.Optional;
@@ -104,19 +102,6 @@ public class RaftActorTest extends AbstractActorTest {
         factory = new TestActorFactory(getSystem());
     }
 
-    @SuppressWarnings("unchecked")
-    private static DataPersistenceProvider mockPersistenceProvider() {
-        final DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
-        doReturn(false).when(dataPersistenceProvider).isRecoveryApplicable();
-        doReturn(0L).when(dataPersistenceProvider).getLastSequenceNumber();
-        doNothing().when(dataPersistenceProvider).saveSnapshot(any(Object.class));
-        doNothing().when(dataPersistenceProvider).persist(any(Object.class), any(Procedure.class));
-        doNothing().when(dataPersistenceProvider).deleteSnapshots(any(SnapshotSelectionCriteria.class));
-        doNothing().when(dataPersistenceProvider).deleteMessages(0L);
-
-        return dataPersistenceProvider;
-    }
-
     @After
     public void tearDown() throws Exception {
         factory.close();
@@ -310,8 +295,7 @@ public class RaftActorTest extends AbstractActorTest {
         mockRaftActor.waitForRecoveryComplete();
 
         RaftActorRecoverySupport mockSupport = mock(RaftActorRecoverySupport.class);
-        doReturn(false).when(mockSupport).handleRecoveryMessage(any(Object.class), any(PersistentDataProvider.class));
-        mockRaftActor.setRaftActorRecoverySupport(mockSupport);
+        mockRaftActor.setRaftActorRecoverySupport(mockSupport );
 
         Snapshot snapshot = Snapshot.create(new byte[]{1}, Collections.<ReplicatedLogEntry>emptyList(), 3, 1, 3, 1);
         SnapshotOffer snapshotOffer = new SnapshotOffer(new SnapshotMetadata("test", 6, 12345), snapshot);
@@ -416,7 +400,7 @@ public class RaftActorTest extends AbstractActorTest {
 
                 config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
 
-                DataPersistenceProvider dataPersistenceProvider = mockPersistenceProvider();
+                DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
 
                 TestActorRef<MockRaftActor> mockActorRef = factory.createTestActor(MockRaftActor.props(persistenceId,
                         Collections.<String, String>emptyMap(), config, dataPersistenceProvider), persistenceId);
@@ -447,7 +431,7 @@ public class RaftActorTest extends AbstractActorTest {
 
                 config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
 
-                DataPersistenceProvider dataPersistenceProvider = mockPersistenceProvider();
+                DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
 
                 TestActorRef<MockRaftActor> mockActorRef = factory.createTestActor(MockRaftActor.props(persistenceId,
                         Collections.<String, String>emptyMap(), config, dataPersistenceProvider), persistenceId);
@@ -615,7 +599,7 @@ public class RaftActorTest extends AbstractActorTest {
                 config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
                 config.setIsolatedLeaderCheckInterval(new FiniteDuration(1, TimeUnit.DAYS));
 
-                DataPersistenceProvider dataPersistenceProvider = mockPersistenceProvider();
+                DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
 
                 Map<String, String> peerAddresses = new HashMap<>();
                 peerAddresses.put(follower1Id, followerActor1.path().toString());
@@ -712,7 +696,7 @@ public class RaftActorTest extends AbstractActorTest {
                 config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
                 config.setIsolatedLeaderCheckInterval(new FiniteDuration(1, TimeUnit.DAYS));
 
-                DataPersistenceProvider dataPersistenceProvider = mockPersistenceProvider();
+                DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
 
                 Map<String, String> peerAddresses = new HashMap<>();
                 peerAddresses.put(leaderId, leaderActor1.path().toString());
@@ -819,7 +803,7 @@ public class RaftActorTest extends AbstractActorTest {
                 config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
                 config.setIsolatedLeaderCheckInterval(new FiniteDuration(1, TimeUnit.DAYS));
 
-                DataPersistenceProvider dataPersistenceProvider = mockPersistenceProvider();
+                DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
 
                 Map<String, String> peerAddresses = new HashMap<>();
                 peerAddresses.put(follower1Id, followerActor1.path().toString());
@@ -1079,7 +1063,7 @@ public class RaftActorTest extends AbstractActorTest {
         String persistenceId = factory.generateActorId("follower-");
         ImmutableMap<String, String> peerAddresses =
             ImmutableMap.<String, String>builder().put("member1", "address").build();
-        DataPersistenceProvider dataPersistenceProvider = mockPersistenceProvider();
+        DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
 
         TestActorRef<MockRaftActor> actorRef = factory.createTestActor(
                 MockRaftActor.props(persistenceId, peerAddresses, emptyConfig, dataPersistenceProvider), persistenceId);
@@ -1153,7 +1137,6 @@ public class RaftActorTest extends AbstractActorTest {
         verify(mockRaftActor.snapshotCohortDelegate, timeout(5000)).createSnapshot(any(ActorRef.class));
 
         mockRaftActor.snapshotCohortDelegate = mock(RaftActorSnapshotCohort.class);
-        doNothing().when(mockRaftActor.snapshotCohortDelegate).createSnapshot(any(ActorRef.class));
 
         raftActorRef.tell(GetSnapshot.INSTANCE, kit.getRef());
 
@@ -1181,7 +1164,6 @@ public class RaftActorTest extends AbstractActorTest {
 
         mockRaftActor.getSnapshotMessageSupport().setSnapshotReplyActorTimeout(Duration.create(200, TimeUnit.MILLISECONDS));
         reset(mockRaftActor.snapshotCohortDelegate);
-        doNothing().when(mockRaftActor.snapshotCohortDelegate).createSnapshot(any(ActorRef.class));
 
         raftActorRef.tell(GetSnapshot.INSTANCE, kit.getRef());
         Failure failure = kit.expectMsgClass(akka.actor.Status.Failure.class);
@@ -1193,7 +1175,6 @@ public class RaftActorTest extends AbstractActorTest {
 
         mockRaftActor.setPersistence(false);
         reset(mockRaftActor.snapshotCohortDelegate);
-        doNothing().when(mockRaftActor.snapshotCohortDelegate).createSnapshot(any(ActorRef.class));
 
         raftActorRef.tell(GetSnapshot.INSTANCE, kit.getRef());
         reply = kit.expectMsgClass(GetSnapshotReply.class);
index cc81e71..51cff35 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.controller.cluster.raft;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.same;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
@@ -58,8 +56,6 @@ public class ReplicatedLogImplTest {
     public void setup() {
         MockitoAnnotations.initMocks(this);
 
-        doNothing().when(mockPersistence).persist(any(Object.class), any(Procedure.class));
-
         context = new RaftActorContextImpl(null, null, "test",
                 new ElectionTermImpl(mockPersistence, "test", LOG),
                 -1, -1, Collections.<String,String>emptyMap(), configParams, mockPersistence, LOG);
@@ -92,10 +88,7 @@ public class ReplicatedLogImplTest {
 
         reset(mockPersistence);
 
-        doNothing().when(mockPersistence).persist(any(MockReplicatedLogEntry.class), any(Procedure.class));
-
         Procedure<ReplicatedLogEntry> mockCallback = Mockito.mock(Procedure.class);
-        doNothing().when(mockCallback).apply(logEntry);
         log.appendAndPersist(logEntry, mockCallback);
 
         verifyPersist(logEntry);
@@ -121,8 +114,6 @@ public class ReplicatedLogImplTest {
 
         reset(mockPersistence);
 
-        doNothing().when(mockPersistence).persist(any(MockReplicatedLogEntry.class), any(Procedure.class));
-
         log.appendAndPersist(logEntry2);
         verifyPersist(logEntry2);
 
@@ -151,8 +142,6 @@ public class ReplicatedLogImplTest {
 
         reset(mockPersistence);
 
-        doNothing().when(mockPersistence).persist(any(MockReplicatedLogEntry.class), any(Procedure.class));
-
         logEntry = new MockReplicatedLogEntry(1, 3, new MockPayload("3", 5));
 
         log.appendAndPersist(logEntry);
index 6b0cd3a..27596df 100644 (file)
@@ -14,7 +14,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyLong;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
@@ -72,7 +71,7 @@ public class SnapshotManagerTest extends AbstractActorTest {
     private TestActorRef<MessageCollectorActor> actorRef;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp(){
         MockitoAnnotations.initMocks(this);
 
         doReturn(false).when(mockRaftActorContext).hasFollowers();
@@ -83,8 +82,6 @@ public class SnapshotManagerTest extends AbstractActorTest {
         doReturn("123").when(mockRaftActorContext).getId();
         doReturn(mockDataPersistenceProvider).when(mockRaftActorContext).getPersistenceProvider();
         doReturn("123").when(mockRaftActorBehavior).getLeaderId();
-        doReturn(null).when(mockRaftActorBehavior).handleMessage(any(ActorRef.class), any(Object.class));
-        doReturn(0L).when(mockRaftActorBehavior).getReplicatedToAllIndex();
 
         doReturn(mockElectionTerm).when(mockRaftActorContext).getTermInformation();
         doReturn(5L).when(mockElectionTerm).getCurrentTerm();
@@ -95,26 +92,6 @@ public class SnapshotManagerTest extends AbstractActorTest {
 
         actorRef = factory.createTestActor(MessageCollectorActor.props(), factory.generateActorId("test-"));
         doReturn(actorRef).when(mockRaftActorContext).getActor();
-        doReturn(0L).when(mockRaftActorContext).getLastApplied();
-        doReturn(null).when(mockRaftActorContext).getPeerServerInfo(any(boolean.class));
-        doReturn(null).when(mockReplicatedLog).get(any(long.class));
-        doReturn(null).when(mockReplicatedLog).getFrom(any(long.class));
-        doReturn(0).when(mockReplicatedLog).dataSize();
-        doReturn(0L).when(mockReplicatedLog).size();
-        doReturn(0L).when(mockReplicatedLog).getSnapshotIndex();
-        doReturn(0L).when(mockReplicatedLog).getSnapshotTerm();
-        doNothing().when(mockReplicatedLog).snapshotPreCommit(any(long.class), any(long.class));
-        doNothing().when(mockReplicatedLog).snapshotRollback();
-        doNothing().when(mockReplicatedLog).snapshotCommit();
-        doNothing().when(mockRaftActorBehavior).setReplicatedToAllIndex(any(long.class));
-
-        doReturn(0L).when(mockDataPersistenceProvider).getLastSequenceNumber();
-        doNothing().when(mockDataPersistenceProvider).saveSnapshot(any(Object.class));
-        doNothing().when(mockDataPersistenceProvider).persist(any(Object.class), any(Procedure.class));
-        doNothing().when(mockDataPersistenceProvider).deleteSnapshots(any(SnapshotSelectionCriteria.class));
-        doNothing().when(mockDataPersistenceProvider).deleteMessages(any(long.class));
-
-        doNothing().when(mockProcedure).apply(null);
 
         snapshotManager.setCreateSnapshotCallable(mockProcedure);
     }
index c251279..8dd81da 100644 (file)
@@ -157,8 +157,6 @@ public class CandidateTest extends AbstractRaftActorBehaviorTest {
     public void testBecomeLeaderOnReceivingMajorityVotesWithNonVotingPeers(){
         ElectionTerm mockElectionTerm = Mockito.mock(ElectionTerm.class);
         Mockito.doReturn(1L).when(mockElectionTerm).getCurrentTerm();
-        Mockito.doNothing().when(mockElectionTerm).updateAndPersist(Mockito.any(long.class), Mockito.any(String.class));
-
         RaftActorContext raftActorContext = new RaftActorContextImpl(candidateActor, candidateActor.actorContext(),
                 "candidate", mockElectionTerm, -1, -1, setupPeers(4), new DefaultConfigParamsImpl(),
                 new NonPersistentDataProvider(), LOG);
@@ -316,7 +314,6 @@ public class CandidateTest extends AbstractRaftActorBehaviorTest {
 
         // Send an unknown message so that the state of the RaftActor remains unchanged
         RaftActorBehavior expected = behavior.handleMessage(candidateActor, "unknown");
-        assertTrue(expected instanceof Candidate);
 
         RaftActorBehavior raftBehavior = behavior.handleMessage(candidateActor, appendEntries);
 
@@ -336,7 +333,6 @@ public class CandidateTest extends AbstractRaftActorBehaviorTest {
         return new MockRaftActorContext("candidate", getSystem(), candidateActor);
     }
 
-    @SuppressWarnings("unchecked")
     private Map<String, String> setupPeers(int count) {
         Map<String, String> peerMap = new HashMap<>();
         peerActors = new TestActorRef[count];
index 505f6d1..1b15ecb 100644 (file)
@@ -840,7 +840,6 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
         // Send an append entry
         AppendEntries appendEntries = mock(AppendEntries.class);
         doReturn(context.getTermInformation().getCurrentTerm()).when(appendEntries).getTerm();
-        doReturn(null).when(appendEntries).getEntries();
 
         follower.handleMessage(leaderActor, appendEntries);
 
@@ -968,8 +967,6 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
         MockRaftActorContext context = createActorContext();
         follower = createBehavior(context);
         follower.handleMessage(leaderActor, new RaftRPC() {
-            private static final long serialVersionUID = 1L;
-
             @Override
             public long getTerm() {
                 return 100;
index 21aa900..b51f0a7 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.controller.cluster.raft.behaviors;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
@@ -1973,7 +1972,6 @@ public class LeaderTest extends AbstractLeaderTest {
         MessageCollectorActor.clearMessages(followerActor);
 
         RaftActorLeadershipTransferCohort mockTransferCohort = mock(RaftActorLeadershipTransferCohort.class);
-        doNothing().when(mockTransferCohort).transferComplete();
         leader.transferLeadership(mockTransferCohort);
 
         verify(mockTransferCohort, never()).transferComplete();
@@ -2006,7 +2004,6 @@ public class LeaderTest extends AbstractLeaderTest {
         MessageCollectorActor.clearMessages(followerActor);
 
         RaftActorLeadershipTransferCohort mockTransferCohort = mock(RaftActorLeadershipTransferCohort.class);
-        doNothing().when(mockTransferCohort).transferComplete();
         leader.transferLeadership(mockTransferCohort);
 
         verify(mockTransferCohort, never()).transferComplete();
@@ -2037,7 +2034,6 @@ public class LeaderTest extends AbstractLeaderTest {
         MessageCollectorActor.clearMessages(followerActor);
 
         RaftActorLeadershipTransferCohort mockTransferCohort = mock(RaftActorLeadershipTransferCohort.class);
-        doNothing().when(mockTransferCohort).transferComplete();
         leader.transferLeadership(mockTransferCohort);
 
         verify(mockTransferCohort, never()).transferComplete();
@@ -2082,7 +2078,6 @@ public class LeaderTest extends AbstractLeaderTest {
         MessageCollectorActor.clearMessages(followerActor);
 
         RaftActorLeadershipTransferCohort mockTransferCohort = mock(RaftActorLeadershipTransferCohort.class);
-        doNothing().when(mockTransferCohort).abortTransfer();
         leader.transferLeadership(mockTransferCohort);
 
         verify(mockTransferCohort, never()).transferComplete();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.