Junits for classes in util package
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / util / DmaapTimestamp.java
index 776a4b4..f36df1c 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.onap.dmaap.dbcapi.util;
 
-import java.util.Calendar;
-import java.util.Date;
-
 import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.log4j.Logger;
+import java.util.Date;
 
 @XmlRootElement
 public class DmaapTimestamp {
-       static final Logger logger = Logger.getLogger(DmaapTimestamp.class);
-       private Calendar cal = Calendar.getInstance();
-       private Date stamp;
-       
-       public DmaapTimestamp() {
-
-               stamp = cal.getTime();
-       }
-       
-       public void mark() {
-               stamp =  cal.getTime();
-       }
-       
-       public Date getVal() {
-               return stamp;
-       }
+    private Date stamp;
+
+    public DmaapTimestamp() {
+        this(new Date());
+    }
+
+    DmaapTimestamp(Date stamp) {
+        this.stamp = new Date(stamp.getTime());
+    }
+
+    public void mark() {
+        stamp = new Date();
+    }
+
+    public Date getVal() {
+        return new Date(stamp.getTime());
+    }
 
 }