aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorPawel <pawel.kasperkiewicz@nokia.com>2019-03-21 05:33:21 -0400
committerPawel <pawel.kasperkiewicz@nokia.com>2019-03-21 09:38:46 -0400
commit44cc0755f83283b7666ad8e2da68c14758bebf08 (patch)
tree585d1f393b8e3c672cb9bd4aa9aeedaa90a095aa /src/test/java
parentcee37b37655ed5a52078e37c7da51c887e2d73e5 (diff)
Extract class StopWatch from ApiService
Issue-ID: DMAAP-1109 Change-Id: I05f706b8f2e7fe0ceb632ddb008c897b32f576b2 Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/dmaap/dbcapi/service/StopWatchTest.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/java/org/onap/dmaap/dbcapi/service/StopWatchTest.java b/src/test/java/org/onap/dmaap/dbcapi/service/StopWatchTest.java
new file mode 100644
index 0000000..b4b6af2
--- /dev/null
+++ b/src/test/java/org/onap/dmaap/dbcapi/service/StopWatchTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.onap.dmaap
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dmaap.dbcapi.service;
+
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
+
+public class StopWatchTest extends BaseLoggingClass {
+
+ private StopWatch stopWatch = new StopWatch();
+
+ @Test
+ public void stopWatchShouldReturnElapsedTime() throws InterruptedException {
+ stopWatch.start();
+ Thread.sleep(50);
+ stopWatch.stop();
+ assertTrue(stopWatch.getElapsedTime() > 0);
+ }
+
+ @Test
+ public void resetShouldSetElapsedTime() {
+ stopWatch.start();
+ stopWatch.stop();
+ stopWatch.resetElapsedTime();
+ assertEquals(0,stopWatch.getElapsedTime());
+
+ }
+
+} \ No newline at end of file