Migrade JUnitMatchers references
authorRobert Varga <rovarga@cisco.com>
Fri, 7 Nov 2014 13:05:56 +0000 (14:05 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 7 Nov 2014 13:10:32 +0000 (14:10 +0100)
With JUnit 4.11 JUnitMatchers.containsString() has been deprecated in
favor of org.hamcrest.CoreMatchers.containsString(). Same goes for
hasItem().

Change-Id: Ie11616588b126110579e92bfb4b72de022bf211c
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregatorTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java

index 641881cf9ee50b71119c930a495ded9920575f73..28849d0033d5c93a0bd98e6ee9d61cb8a00f5845 100644 (file)
@@ -55,10 +55,10 @@ import org.custommonkey.xmlunit.NodeTestException;
 import org.custommonkey.xmlunit.NodeTester;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.custommonkey.xmlunit.XMLUnit;
+import org.hamcrest.CoreMatchers;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.junit.matchers.JUnitMatchers;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
@@ -569,7 +569,7 @@ public class NetconfMappingTest extends AbstractConfigTest {
     }
 
     private void assertContainsString(String string, String substring) {
-        assertThat(string, JUnitMatchers.containsString(substring));
+        assertThat(string, CoreMatchers.containsString(substring));
     }
 
     private void checkEnum(final Document response) throws Exception {
index 1e650c08b124a460c7d19f65200c1b0868ccee17..b051c6c1c6237bb3d4816adbd6f86aa8b329487d 100644 (file)
@@ -24,7 +24,7 @@ import java.util.Set;
 
 import org.junit.Assert;
 import org.junit.Test;
-import org.junit.matchers.JUnitMatchers;
+import org.hamcrest.CoreMatchers;
 import org.opendaylight.controller.config.api.LookupRegistry;
 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -72,11 +72,11 @@ public class NetconfOperationServiceImplTest {
             String message = e.getMessage();
             Assert.assertThat(
                     message,
-                    JUnitMatchers
+                    CoreMatchers
                     .containsString("missing from config subsystem but present in yangstore: [(namespace?revision=1970-01-01)qname2]"));
             Assert.assertThat(
                     message,
-                    JUnitMatchers
+                    CoreMatchers
                     .containsString("All modules present in config: [(namespace?revision=1970-01-01)qname1]"));
         }
     }
index cd646aeb079100a72a230f9d62624504a72a5ad2..bef1237f980116f84f0f0ba8dc0f58b10028850b 100644 (file)
@@ -23,11 +23,11 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
 
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.opendaylight.controller.netconf.persist.impl.PersisterAggregator.PersisterWithConfiguration;
index 3f04010015e8291d8dbeb6e47415d6ab8a12ad3f..c8140973eb9d7ee0c890cbba77ffaa6b8c689327 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.controller.netconf.persist.impl.osgi;
 
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
-import org.junit.matchers.JUnitMatchers;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,7 +49,7 @@ final class TestingExceptionHandler implements Thread.UncaughtExceptionHandler {
     private void assertException(Throwable t, Class<? extends Exception> exType, String exMessageToContain) {
         assertEquals("Expected exception of type " + exType + " but was " + t, exType, t.getClass());
         if(exMessageToContain!=null) {
-            assertThat(t.getMessage(), JUnitMatchers.containsString(exMessageToContain));
+            assertThat(t.getMessage(), containsString(exMessageToContain));
         }
     }