Fixed test which tested incorrect string formating 56/11056/1
authorTony Tkacik <ttkacik@cisco.com>
Thu, 11 Sep 2014 14:45:53 +0000 (16:45 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Thu, 11 Sep 2014 14:46:02 +0000 (16:46 +0200)
It turned out, that this test suite tested returned
formated string from YANGTools, which format was not
part of API Contract.

Updated test to test to only for non nulls, which
are parts of API Contract.

Change-Id: I6e33993928667c6e8b4a830b6d0a9c8d10cd4fa2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/jmx/CommitStatsMXBeanImplTest.java

index d79693030221a256d963b12b7f1b8de9783b421b..613b7a60ab986521c271e3055f68476dab69d37d 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl.jmx;
 
 import static org.junit.Assert.assertEquals;
 package org.opendaylight.controller.md.sal.dom.broker.impl.jmx;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.util.DurationStatsTracker;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.util.DurationStatsTracker;
@@ -29,13 +30,9 @@ public class CommitStatsMXBeanImplTest {
 
         commitStatsTracker.addDuration(100);
 
 
         commitStatsTracker.addDuration(100);
 
-        String prefix = "100.0 ns";
         assertEquals("getTotalCommits", 1L, bean.getTotalCommits());
         assertEquals("getTotalCommits", 1L, bean.getTotalCommits());
-        assertEquals("getLongestCommitTime starts with \"" + prefix + "\"", true,
-                     bean.getLongestCommitTime().startsWith("100.0 ns"));
-        assertEquals("getShortestCommitTime starts with \"" + prefix + "\"", true,
-                     bean.getShortestCommitTime().startsWith(prefix));
-        assertEquals("getAverageCommitTime starts with \"" + prefix + "\"", true,
-                     bean.getAverageCommitTime().startsWith(prefix));
+        assertNotNull(bean.getLongestCommitTime());
+        assertNotNull(bean.getShortestCommitTime());
+        assertNotNull(bean.getAverageCommitTime());
     }
 }
     }
 }