mirror of
https://github.com/alibaba/arthas.git
synced 2026-10-22 01:57:26 +00:00
Test case for DateUtils (#195)
This commit is contained in:
committed by
Huxing Zhang
parent
89e39fb2fc
commit
dbcde9fe42
@@ -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());
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user