From: Robert Varga Date: Fri, 7 Nov 2014 12:42:30 +0000 (+0100) Subject: Update junit Assert imports X-Git-Tag: release/lithium~876^2~5^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=54acc3c8f479b547877a5057cea143546e905470 Update junit Assert imports JUnit 4.11 has moved Assert to org.junit, and deprecated junit.framework.Assert. This adjust the imports to fix the warnings. Change-Id: Iecbf2a1b4ae097989e840ad6f6d5bf759c521639 Signed-off-by: Robert Varga --- diff --git a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java index 07fbf0599b..07b18d7725 100644 --- a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java +++ b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java @@ -9,8 +9,7 @@ package org.opendaylight.controller.sal.packet; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; import org.opendaylight.controller.liblldp.BitBufferHelper; diff --git a/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java b/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java index 2bfe70adb8..942ba4c4b3 100644 --- a/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java +++ b/opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java @@ -8,12 +8,12 @@ package org.opendaylight.controller.config.persist.storage.file.xml; -import static junit.framework.Assert.assertFalse; +import static org.junit.Assert.assertFalse; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; - +import com.google.common.base.Charsets; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -21,17 +21,12 @@ import java.nio.file.Files; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; - -import junit.framework.Assert; - import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder; import org.opendaylight.controller.config.persist.test.PropertiesProviderTest; -import com.google.common.base.Charsets; - public class FileStorageAdapterTest { private static int i; @@ -42,8 +37,9 @@ public class FileStorageAdapterTest { @Before public void setUp() throws Exception { file = Files.createTempFile("testFilePersist", ".txt").toFile(); - if (!file.exists()) + if (!file.exists()) { return; + } com.google.common.io.Files.write("", file, Charsets.UTF_8); i = 1; } @@ -71,7 +67,7 @@ public class FileStorageAdapterTest { storage.persistConfig(holder); - Assert.assertEquals(storage.toString().replace("\\","/"),"XmlFileStorageAdapter [storage="+NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE+"]"); + assertEquals(storage.toString().replace("\\","/"),"XmlFileStorageAdapter [storage="+NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE+"]"); delete(new File(NON_EXISTENT_DIRECTORY)); } @Test @@ -109,7 +105,7 @@ public class FileStorageAdapterTest { storage.setNumberOfBackups(Integer.MAX_VALUE); List last = storage.loadLastConfigs(); - Assert.assertEquals(createCaps(), last.get(0).getCapabilities()); + assertEquals(createCaps(), last.get(0).getCapabilities()); } private SortedSet createCaps() { @@ -188,8 +184,9 @@ public class FileStorageAdapterTest { @Test public void testNoLastConfig() throws Exception { File file = Files.createTempFile("testFilePersist", ".txt").toFile(); - if (!file.exists()) + if (!file.exists()) { return; + } XmlFileStorageAdapter storage = new XmlFileStorageAdapter(); storage.setFileStorage(file); @@ -223,12 +220,14 @@ public class FileStorageAdapterTest { return "" + i++ + ""; } - private void delete(File f) throws IOException { + private void delete(final File f) throws IOException { if (f.isDirectory()) { - for (File c : f.listFiles()) + for (File c : f.listFiles()) { delete(c); + } } - if (!f.delete()) + if (!f.delete()) { throw new FileNotFoundException("Failed to delete file: " + f); + } } } diff --git a/opendaylight/config/netty-timer-config/src/test/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModuleTest.java b/opendaylight/config/netty-timer-config/src/test/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModuleTest.java index 5fe5f9496e..578476f0f7 100644 --- a/opendaylight/config/netty-timer-config/src/test/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModuleTest.java +++ b/opendaylight/config/netty-timer-config/src/test/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModuleTest.java @@ -7,12 +7,11 @@ */ package org.opendaylight.controller.config.yang.netty.timer; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.ObjectName; - -import junit.framework.Assert; - import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.config.api.ConflictingVersionException; @@ -42,9 +41,9 @@ public class HashedWheelTimerModuleTest extends AbstractConfigTest { try { createInstance(transaction, instanceName, 0L, 10, true); transaction.validateConfig(); - Assert.fail(); + fail(); } catch (ValidationException e) { - Assert.assertTrue(e.getMessage().contains("TickDuration value must be greater than 0")); + assertTrue(e.getMessage().contains("TickDuration value must be greater than 0")); } } @@ -53,9 +52,9 @@ public class HashedWheelTimerModuleTest extends AbstractConfigTest { try { createInstance(transaction, instanceName, 500L, 0, true); transaction.validateConfig(); - Assert.fail(); + fail(); } catch (ValidationException e) { - Assert.assertTrue(e.getMessage().contains("TicksPerWheel value must be greater than 0")); + assertTrue(e.getMessage().contains("TicksPerWheel value must be greater than 0")); } } @@ -112,7 +111,7 @@ public class HashedWheelTimerModuleTest extends AbstractConfigTest { assertStatus(status, 0, 1, 1); } - private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName, + private ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String instanceName, final Long tickDuration, final Integer ticksPerWheel, final boolean hasThreadfactory) throws InstanceAlreadyExistsException { ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName); @@ -126,7 +125,7 @@ public class HashedWheelTimerModuleTest extends AbstractConfigTest { return nameCreated; } - private ObjectName createThreadfactoryInstance(ConfigTransactionJMXClient transaction, String instanceName, + private ObjectName createThreadfactoryInstance(final ConfigTransactionJMXClient transaction, final String instanceName, final String namePrefix) throws InstanceAlreadyExistsException { ObjectName nameCreated = transaction.createModule(threadFactory.getImplementationName(), instanceName); NamingThreadFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, diff --git a/opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGeneratorGeneratedFilesTrackerTest.java b/opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGeneratorGeneratedFilesTrackerTest.java index 4112ff017a..589fe41f46 100644 --- a/opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGeneratorGeneratedFilesTrackerTest.java +++ b/opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGeneratorGeneratedFilesTrackerTest.java @@ -7,10 +7,8 @@ */ package org.opendaylight.controller.config.yangjmxgenerator.plugin; +import static org.junit.Assert.assertEquals; import java.io.File; - -import junit.framework.Assert; - import org.junit.Test; public class JMXGeneratorGeneratedFilesTrackerTest { @@ -20,7 +18,7 @@ public class JMXGeneratorGeneratedFilesTrackerTest { JMXGenerator.GeneratedFilesTracker tracker = new JMXGenerator.GeneratedFilesTracker(); tracker.addFile(new File("./a/b/c")); - Assert.assertEquals(1, tracker.getFiles().size()); + assertEquals(1, tracker.getFiles().size()); tracker.addFile(new File("./a/b/c")); } } diff --git a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/AbstractYangTest.java b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/AbstractYangTest.java index b9f2ba9cd1..e3c3a3024c 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/AbstractYangTest.java +++ b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/AbstractYangTest.java @@ -7,8 +7,7 @@ */ package org.opendaylight.controller.config.yangjmxgenerator; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.format; +import static org.junit.Assert.assertNotNull; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -92,8 +91,8 @@ public abstract class AbstractYangTest { QName qName = identitySchemaNode.getQName(); Preconditions.checkArgument( result.containsKey(qName) == false, - format("Two identities of %s contain same " + "qname %s", - module, qName)); + "Two identities of %s contain same qname %s", + module, qName); result.put(qName, identitySchemaNode); } return result; diff --git a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java index e80ebc67a5..38b0a3afec 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java +++ b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java @@ -7,10 +7,10 @@ */ package org.opendaylight.controller.config.yangjmxgenerator; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNull; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; diff --git a/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java b/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java index 13a31f5976..fb9264749b 100644 --- a/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java +++ b/opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.java @@ -9,8 +9,6 @@ package org.opendaylight.controller.config.yang.test.impl; import com.google.common.collect.Lists; -import junit.framework.Assert; - import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.config.api.IdentityAttributeRef; @@ -96,7 +94,7 @@ public class NetconfTestImplModuleTest extends AbstractConfigTest { List testingDeps = proxy.getTestingDeps(); ObjectName testingDep = proxy.getTestingDep(); - Assert.assertEquals(TESTING_DEP_PREFIX, ObjectNameUtil.getInstanceName(testingDep)); + assertEquals(TESTING_DEP_PREFIX, ObjectNameUtil.getInstanceName(testingDep)); assertTestingDeps(testingDeps, 4); transaction.abortConfig(); @@ -135,11 +133,11 @@ public class NetconfTestImplModuleTest extends AbstractConfigTest { } private void assertTestingDeps(List testingDeps, int i) { - Assert.assertEquals(i, testingDeps.size()); + assertEquals(i, testingDeps.size()); int c = 1; for (ObjectName testingDep : testingDeps) { - Assert.assertEquals(TESTING_DEP_PREFIX + Integer.toString(c++), ObjectNameUtil.getInstanceName(testingDep)); + assertEquals(TESTING_DEP_PREFIX + Integer.toString(c++), ObjectNameUtil.getInstanceName(testingDep)); } } diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/MDFlowMappingTest.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/MDFlowMappingTest.java index 78e82c32de..2490ace648 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/MDFlowMappingTest.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/MDFlowMappingTest.java @@ -7,8 +7,7 @@ */ package org.opendaylight.controller.sal.compatibility.test; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; import org.opendaylight.controller.sal.action.Action; import org.opendaylight.controller.sal.action.PushVlan; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java index 45341fb734..54ffddbbe3 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java @@ -22,8 +22,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import junit.framework.Assert; - import org.junit.Test; import org.opendaylight.controller.sal.action.Flood; import org.opendaylight.controller.sal.action.FloodAll; @@ -198,7 +196,7 @@ public class TestToSalConversionsUtils { public void testFromNodeConnectorRef() throws ConstructionException { Node node = new Node(NodeIDType.OPENFLOW, 42L); NodeConnector nodeConnector = ToSalConversionsUtils.fromNodeConnectorRef(new Uri("1"), node); - Assert.assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString()); + assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString()); } private void checkSalMatch(org.opendaylight.controller.sal.match.Match match, MtchType mt) throws ConstructionException { diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/topology/test/TopologyMappingTest.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/topology/test/TopologyMappingTest.java index 9369217d78..2a0d47e9c2 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/topology/test/TopologyMappingTest.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/topology/test/TopologyMappingTest.java @@ -7,7 +7,7 @@ */ package org.opendaylight.controller.sal.compatibility.topology.test; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.opendaylight.controller.sal.compatibility.topology.TopologyMapping; @@ -30,7 +30,7 @@ public class TopologyMappingTest { NodeId nodeId = new NodeId("openflow:1"); String observedNodeId = TopologyMapping.toADNodeId(nodeId); - Assert.assertEquals("1", observedNodeId); + assertEquals("1", observedNodeId); } /** @@ -43,7 +43,7 @@ public class TopologyMappingTest { TpId source = new TpId("foo:2"); NodeConnector observedNodeConnector = TopologyMapping.toADNodeConnector(source, nodeId); - Assert.assertEquals("OF|2@OF|00:00:00:00:00:00:00:01", observedNodeConnector.toString()); + assertEquals("OF|2@OF|00:00:00:00:00:00:00:01", observedNodeConnector.toString()); } /** @@ -54,7 +54,7 @@ public class TopologyMappingTest { TpId source = new TpId("foo:2"); String observedNodeConnectorId = TopologyMapping.toADNodeConnectorId(source); - Assert.assertEquals("2", observedNodeConnectorId); + assertEquals("2", observedNodeConnectorId); } /** @@ -66,7 +66,7 @@ public class TopologyMappingTest { NodeId nodeId = new NodeId("openflow:1"); Node observedNode = TopologyMapping.toADNode(nodeId); - Assert.assertEquals("OF|00:00:00:00:00:00:00:01", observedNode.toString()); + assertEquals("OF|00:00:00:00:00:00:00:01", observedNode.toString()); } /** @@ -79,7 +79,7 @@ public class TopologyMappingTest { TpId source = new TpId("192.168.0.1"); NodeConnector observedNodeConnector = TopologyMapping.toADNodeConnector(source, nodeId); - Assert.assertEquals("MD_SAL_DEPRECATED|192.168.0.1@MD_SAL_DEPRECATED|some_unknown_node", observedNodeConnector.toString()); + assertEquals("MD_SAL_DEPRECATED|192.168.0.1@MD_SAL_DEPRECATED|some_unknown_node", observedNodeConnector.toString()); } } diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java index a8d47e2c60..fb02481115 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java @@ -3,7 +3,7 @@ package org.opendaylight.controller.cluster.raft.behaviors; import akka.actor.ActorRef; import akka.actor.Props; import akka.testkit.JavaTestKit; -import junit.framework.Assert; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl; diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java index edeab11e2a..83b9ad3ec7 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java @@ -4,7 +4,6 @@ import akka.actor.ActorRef; import akka.actor.Props; import akka.testkit.JavaTestKit; import com.google.protobuf.ByteString; -import junit.framework.Assert; import org.junit.Test; import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl; import org.opendaylight.controller.cluster.raft.MockRaftActorContext; @@ -87,7 +86,7 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest { RaftActorBehavior raftBehavior = follower.handleMessage(followerActor, new ElectionTimeout()); - Assert.assertTrue(raftBehavior instanceof Candidate); + assertTrue(raftBehavior instanceof Candidate); } @Test diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java index 227354c41e..c8129e6eca 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java @@ -7,9 +7,7 @@ */ package org.opendaylight.controller.sal.binding.test; -import junit.framework.Assert; - - +import static org.junit.Assert.assertNotNull; import org.opendaylight.yangtools.yang.binding.Augmentable; import org.opendaylight.yangtools.yang.binding.Augmentation; @@ -28,8 +26,8 @@ public class AugmentationVerifier> { public static > void assertHasAugmentation(T object, Class> augmentation) { - Assert.assertNotNull(object); - Assert.assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation)); + assertNotNull(object); + assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation)); } public static > AugmentationVerifier from(T obj) { diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java index 4cc3780c6f..ba75d578fb 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java @@ -7,10 +7,10 @@ */ package org.opendaylight.controller.sal.binding.test.connect.dom; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNotSame; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertTrue; import java.math.BigInteger; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java index 6686a83a2e..7d616ca62c 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java @@ -7,9 +7,9 @@ */ package org.opendaylight.controller.sal.binding.test.connect.dom; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; -import static junit.framework.Assert.fail; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.InputStream; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java index df287791ef..47e79650fe 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java @@ -7,7 +7,7 @@ */ package org.opendaylight.controller.sal.binding.test.connect.dom; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java index 6de1083cbe..5d5318f19a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java @@ -26,8 +26,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; import java.util.List; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class NormalizedNodeToNodeCodecTest { diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java index 4da7d8c483..13dfff3a8a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java @@ -10,7 +10,7 @@ package org.opendaylight.controller.cluster.datastore.node.utils; -import junit.framework.Assert; +import static org.junit.Assert.assertTrue; import org.junit.Test; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -22,8 +22,7 @@ public class NodeIdentifierFactoryTest { NodeIdentifierFactory .getArgument("AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}"); - Assert - .assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier); + assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactoryTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactoryTest.java index 76d4ceb2f5..2ae83bd6c6 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactoryTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactoryTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.opendaylight.controller.cluster.datastore.util.TestModel; import org.opendaylight.yangtools.yang.common.QName; -import static junit.framework.Assert.assertTrue; -import static junit.framework.TestCase.assertEquals; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class QNameFactoryTest { diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java index 0688bfbc5c..60dbcb0516 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/xml/codec/XmlUtilsTest.java @@ -8,11 +8,16 @@ package org.opendaylight.controller.xml.codec; - import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.io.ByteSource; -import junit.framework.Assert; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import javax.xml.parsers.DocumentBuilderFactory; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; @@ -27,15 +32,6 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; -import javax.xml.parsers.DocumentBuilderFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - - public class XmlUtilsTest { private static final DocumentBuilderFactory BUILDERFACTORY; diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java index 608fd72f4a..e876ccb306 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java +++ b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.sal.dom.broker; -import static junit.framework.Assert.fail; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java index 127b0cbfcd..5d19188b12 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java @@ -1,14 +1,12 @@ package org.opendaylight.controller.sal.connect.netconf; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.io.InputStream; import java.util.Collections; import java.util.List; import java.util.Set; - import javax.xml.parsers.DocumentBuilderFactory; import org.junit.Before; import org.junit.Test; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToRpcRequestTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToRpcRequestTest.java index 4bf2e8463e..bbb5038caf 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToRpcRequestTest.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToRpcRequestTest.java @@ -1,8 +1,8 @@ package org.opendaylight.controller.sal.connect.netconf; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.io.InputStream; import java.util.Collections; diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java index a65e426d59..0607e4b6da 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java @@ -1,6 +1,6 @@ package org.opendaylight.controller.sal.connect.netconf.sal.tx; -import static junit.framework.Assert.fail; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doReturn; diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java index cd031a1d0a..f74bfc3cff 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java @@ -8,14 +8,13 @@ package org.opendaylight.controller.remote.rpc.utils; - +import static org.junit.Assert.assertTrue; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.japi.Pair; import akka.testkit.JavaTestKit; import akka.testkit.TestProbe; import com.typesafe.config.ConfigFactory; -import junit.framework.Assert; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -23,7 +22,6 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; - public class LatestEntryRoutingLogicTest { static ActorSystem system; @@ -52,6 +50,6 @@ public class LatestEntryRoutingLogicTest { pairList.add(new Pair(actor2, 3000L)); pairList.add(new Pair(actor3, 2000L)); RoutingLogic logic = new LatestEntryRoutingLogic(pairList); - Assert.assertTrue(logic.select().equals(actor2)); + assertTrue(logic.select().equals(actor2)); } } diff --git a/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java b/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java index 9165281f9d..02c5137fe9 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java +++ b/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java @@ -14,7 +14,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; import javax.ws.rs.core.UriInfo; -import junit.framework.Assert; import org.json.JSONException; import org.json.JSONObject; import org.junit.After; @@ -205,7 +204,7 @@ public class ApiDocGeneratorTest { if (m.getKey().getAbsolutePath().endsWith("toaster.yang")) { ApiDeclaration doc = generator.getSwaggerDocSpec(m.getValue(), "http://localhost:8080/restconf", "", schemaContext); - Assert.assertNotNull(doc); + assertNotNull(doc); // testing bugs.opendaylight.org bug 1290. UnionType model type. String jsonString = doc.getModels().toString(); diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/AdditionalHeaderParserTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/AdditionalHeaderParserTest.java index c2dcd67921..444d4fe4ab 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/AdditionalHeaderParserTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/AdditionalHeaderParserTest.java @@ -7,8 +7,7 @@ */ package org.opendaylight.controller.netconf.impl; -import junit.framework.Assert; - +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader; @@ -18,18 +17,18 @@ public class AdditionalHeaderParserTest { public void testParsing() throws Exception { String s = "[netconf;10.12.0.102:48528;ssh;;;;;;]"; NetconfHelloMessageAdditionalHeader header = NetconfHelloMessageAdditionalHeader.fromString(s); - Assert.assertEquals("netconf", header.getUserName()); - Assert.assertEquals("10.12.0.102", header.getAddress()); - Assert.assertEquals("ssh", header.getTransport()); + assertEquals("netconf", header.getUserName()); + assertEquals("10.12.0.102", header.getAddress()); + assertEquals("ssh", header.getTransport()); } @Test public void testParsing2() throws Exception { String s = "[tomas;10.0.0.0/10000;tcp;1000;1000;;/home/tomas;;]"; NetconfHelloMessageAdditionalHeader header = NetconfHelloMessageAdditionalHeader.fromString(s); - Assert.assertEquals("tomas", header.getUserName()); - Assert.assertEquals("10.0.0.0", header.getAddress()); - Assert.assertEquals("tcp", header.getTransport()); + assertEquals("tomas", header.getUserName()); + assertEquals("10.0.0.0", header.getAddress()); + assertEquals("tcp", header.getTransport()); } @Test(expected = IllegalArgumentException.class) diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java index 58c6566d91..b54b218033 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java @@ -7,7 +7,7 @@ */ package org.opendaylight.controller.netconf.impl; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.opendaylight.controller.netconf.api.NetconfMessage; diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchemaTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchemaTest.java index b655e90f2b..4218176f1d 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchemaTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchemaTest.java @@ -8,8 +8,13 @@ package org.opendaylight.controller.netconf.impl.mapping.operations; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; import com.google.common.base.Optional; -import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; @@ -18,13 +23,6 @@ import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.w3c.dom.Document; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; - public class DefaultGetSchemaTest { private CapabilityProvider cap; diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java index d8eb841a79..cc170358dd 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java @@ -7,7 +7,7 @@ */ package org.opendaylight.controller.netconf.it; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doAnswer; diff --git a/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java b/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java index 1c35404c80..13431fbd86 100644 --- a/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java +++ b/opendaylight/northbound/bundlescanner/implementation/src/test/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScannerTest.java @@ -7,8 +7,6 @@ */ package org.opendaylight.controller.northbound.bundlescanner.internal; - - import java.io.File; import java.io.FileFilter; import java.net.MalformedURLException; @@ -37,8 +35,8 @@ import org.osgi.framework.Constants; import org.springframework.osgi.mock.MockBundle; import org.springframework.osgi.mock.MockBundleContext; -import static junit.framework.Assert.assertNotNull; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class BundleScannerTest { diff --git a/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java b/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java index 298f32877a..bcfa2a9ee9 100644 --- a/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java +++ b/opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java @@ -7,8 +7,6 @@ */ package org.opendaylight.controller.topology.northbound; - - import org.junit.Test; import org.opendaylight.controller.sal.core.Bandwidth; import org.opendaylight.controller.sal.core.ConstructionException; @@ -28,7 +26,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; public class TopologyTest {