Cleanup AbstractDOMBrokerWriteTransactionTest 83/98483/3
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 13 Nov 2021 17:39:45 +0000 (18:39 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 13 Nov 2021 19:19:32 +0000 (20:19 +0100)
Use mockito runner instead of initMocks().

Change-Id: I205513eb6600deb9380db9b0380e2f70ac556f89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransactionTest.java

index 1680a79..e77f645 100644 (file)
@@ -15,20 +15,19 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.concurrent.ExecutionException;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
 
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class AbstractDOMBrokerWriteTransactionTest {
-
     @Mock
-    private AbstractDOMTransactionFactory abstractDOMTransactionFactory;
-
+    private AbstractDOMTransactionFactory<?> abstractDOMTransactionFactory;
     @Mock
     private DOMStoreWriteTransaction domStoreWriteTransaction;
 
@@ -40,7 +39,7 @@ public class AbstractDOMBrokerWriteTransactionTest {
         }
 
         @Override
-        protected DOMStoreWriteTransaction createTransaction(LogicalDatastoreType key) {
+        protected DOMStoreWriteTransaction createTransaction(final LogicalDatastoreType key) {
             return null;
         }
 
@@ -50,11 +49,6 @@ public class AbstractDOMBrokerWriteTransactionTest {
         }
     }
 
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-    }
-
     @Test
     public void readyRuntimeExceptionAndCancel() throws InterruptedException {
         RuntimeException thrown = new RuntimeException();