summaryrefslogtreecommitdiffstats
path: root/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java')
-rw-r--r--aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java
index 50a2d053..34aecd56 100644
--- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java
+++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java
@@ -20,19 +20,20 @@
package org.onap.aai.logging;
+import static java.lang.Thread.sleep;
+import static org.junit.Assert.*;
+
import org.junit.After;
import org.junit.Test;
import org.slf4j.MDC;
-import static java.lang.Thread.sleep;
-import static org.junit.Assert.*;
-
public class StopWatchTest {
@After
public void cleanup() {
MDC.clear();
}
+
@Test
public void elapsedTimeTest() throws InterruptedException {
StopWatch.start();
@@ -40,6 +41,7 @@ public class StopWatchTest {
StopWatch.stop();
assertTrue(Long.parseLong(MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString())) >= 1000L);
}
+
@Test
public void elapsedTimeConditionalTest() throws InterruptedException {
StopWatch.conditionalStart();
@@ -49,12 +51,13 @@ public class StopWatchTest {
long elapsedTime = Long.parseLong(elapsedTimeStr);
assertTrue(elapsedTime >= 1000L);
}
+
@Test
public void clearTest() throws InterruptedException {
StopWatch.start();
sleep(1010);
StopWatch.stop();
- assertNotNull( MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString()));
+ assertNotNull(MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString()));
StopWatch.clear();
assertNull(MDC.get(LoggingContext.LoggingField.STOP_WATCH_START.toString()));