Merge "BUG-650: Split out CommitCoordinationTask"
[controller.git] / opendaylight / config / config-api / src / test / java / org / opendaylight / controller / config / api / jmx / ObjectNameUtilTest.java
index d3d8469dfba7b0409a0c7738be2b43ca76f4a57b..ad1a53a5436b8572184275c473f47d7b1f11502b 100644 (file)
@@ -7,16 +7,16 @@
  */
 package org.opendaylight.controller.config.api.jmx;
 
-import static junit.framework.Assert.fail;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import com.google.common.base.Throwables;
 import com.google.common.collect.Maps;
+import java.util.HashMap;
 import java.util.Map;
 import javax.management.ObjectName;
-import junit.framework.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ModuleIdentifier;
@@ -82,7 +82,7 @@ public class ObjectNameUtilTest {
         assertPattern(on, pattern);
     }
 
-    private void assertPattern(ObjectName test, ObjectName pattern) {
+    private void assertPattern(final ObjectName test, final ObjectName pattern) {
         assertTrue(pattern.isPattern());
         assertTrue(pattern.apply(test));
     }
@@ -148,15 +148,26 @@ public class ObjectNameUtilTest {
         }, IllegalArgumentException.class);
     }
 
-    private void assertFailure(Runnable test, Class<? extends Exception> ex) {
+    private void assertFailure(final Runnable test, final Class<? extends Exception> ex) {
         try {
             test.run();
         } catch(Exception e) {
-            Assert.assertTrue("Failed with wrong exception: " + Throwables.getStackTraceAsString(e),
+            assertTrue("Failed with wrong exception: " + Throwables.getStackTraceAsString(e),
                     e.getClass().isAssignableFrom(ex));
             return;
         }
 
         fail(test + " should have failed on " + ex);
     }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testCreateON() throws Exception {
+        ObjectNameUtil.createON(">}+!#");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testCreateON2() throws Exception {
+        Map<String, String> map = new HashMap<>();
+        ObjectNameUtil.createON(">}+!#", map);
+    }
 }