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 d796930..613b7a6 100644 (file)
@@ -9,6 +9,7 @@
 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;
@@ -29,13 +30,9 @@ public class CommitStatsMXBeanImplTest {
 
         commitStatsTracker.addDuration(100);
 
-        String prefix = "100.0 ns";
         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());
     }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.