Remove System.out and improve the test 64/4164/1
authorRobert Varga <rovarga@cisco.com>
Mon, 13 Jan 2014 09:27:56 +0000 (10:27 +0100)
committerRobert Varga <rovarga@cisco.com>
Mon, 13 Jan 2014 09:27:56 +0000 (10:27 +0100)
Change-Id: I53d13a6f08aab159f3c52a1377852c957bc6011e
Signed-off-by: Robert Varga <rovarga@cisco.com>
programming/api/src/test/java/org/opendaylight/bgpcep/programming/NanotimeUtilTest.java

index f5eedd30b8fe42c4e0b3150ff9def7934d0cefa8..00e4222de6ecc3f8297f0f703196d6cd1205f308 100644 (file)
@@ -12,8 +12,12 @@ import static org.junit.Assert.assertTrue;
 import java.math.BigInteger;
 
 import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.Nanotime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NanotimeUtilTest {
+       private static final Logger LOG = LoggerFactory.getLogger(NanotimeUtilTest.class);
 
        @Test
        public void testCurrentTime() {
@@ -22,7 +26,12 @@ public class NanotimeUtilTest {
        }
 
        @Test
-       public void testNanoTime() {
-               System.out.println(NanotimeUtil.currentNanoTime());
+       public void testNanoTime() throws InterruptedException {
+               final Nanotime nt1 = NanotimeUtil.currentNanoTime();
+               Thread.sleep(1);
+               final Nanotime nt2 = NanotimeUtil.currentNanoTime();
+
+               LOG.debug("Times: {} {}", nt1, nt2);
+               assertTrue(nt1.getValue().compareTo(nt2.getValue()) < 0);
        }
 }