diff --git a/core/src/test/java/com/taobao/arthas/core/util/DateUtilsTest.java b/core/src/test/java/com/taobao/arthas/core/util/DateUtilsTest.java new file mode 100644 index 000000000..593a0d688 --- /dev/null +++ b/core/src/test/java/com/taobao/arthas/core/util/DateUtilsTest.java @@ -0,0 +1,28 @@ +package com.taobao.arthas.core.util; + import java.text.SimpleDateFormat; +import java.util.Date; +import org.junit.Assert; +import org.junit.Test; + /** + * + * @author brijeshprasad89 + * + */ +public class DateUtilsTest { + + @Test + public void testGetCurrentDateWithCorrectFormat() { + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //supported date format + Assert.assertEquals(DateUtils.getCurrentDate(),dateFormat.format(new Date()).toString()); + + } + + @Test + public void testGetCurrentDateWithInCorrectFormat() { + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // Not supported Date format + Assert.assertNotEquals(DateUtils.getCurrentDate(),dateFormat.format(new Date()).toString()); + + } + } \ No newline at end of file