add more UT for tostring
This commit is contained in:
parent
5adb3e455c
commit
147616f41c
@ -111,17 +111,26 @@ public class ToFromConversionTests extends RefineTest {
|
||||
|
||||
@Test
|
||||
public void testToString() throws CalendarParserException {
|
||||
// Assert.assertTrue(invoke("toString") instanceof EvalError);
|
||||
// Assert.assertEquals(invoke("toString", (Object) null), "null");
|
||||
// Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100");
|
||||
// Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0");
|
||||
// Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100");
|
||||
//
|
||||
String intputDate = "2013-06-01";
|
||||
// Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(intputDate)),
|
||||
// "01-Jun-2013");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(intputDate), "yyyy-MM-dd"),
|
||||
Assert.assertTrue(invoke("toString") instanceof EvalError);
|
||||
Assert.assertEquals(invoke("toString", (Object) null), "null");
|
||||
Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100");
|
||||
Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0");
|
||||
Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100");
|
||||
|
||||
String inputDate = "2013-06-01";
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDate)),
|
||||
"01-Jun-2013");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDate), "yyyy-MM-dd"),
|
||||
"2013-06-01");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDate), "yyyy/dd/MM"), "2013/01/06");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDate), "yyyy-MMM"), "2013-Jun");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDate), "yyyy-MM-dd hh:mm:ss"), "2013-06-01 12:00:00");
|
||||
|
||||
String inputDateTime = "2013-06-01 13:12:11";
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDateTime)), "01-Jun-2013");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd"), "2013-06-01");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd hh:mm:ss"),"2013-06-01 01:12:11");
|
||||
Assert.assertEquals(invoke("toString", CalenderParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd HH:mm:ss"),"2013-06-01 13:12:11");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user