Skip to content

Commit

Permalink
fixed testcase.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Oct 7, 2017
1 parent dd30ab7 commit fa95cf7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/test/java/com/alibaba/json/bvt/date/DateFieldFormatTest.java
Expand Up @@ -28,9 +28,17 @@ public void test_format_() throws Exception {
String text = JSON.toJSONString(model);
System.out.println(text);

String t1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).format(now);
String t2 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.CHINA).format(now);
String t3 = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).format(now);
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
SimpleDateFormat df2 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.CHINA);
SimpleDateFormat df3 = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);

df1.setTimeZone(JSON.defaultTimeZone);
df2.setTimeZone(JSON.defaultTimeZone);
df3.setTimeZone(JSON.defaultTimeZone);

String t1 = df1.format(now);
String t2 = df2.format(now);
String t3 = df3.format(now);

Assert.assertEquals("{\"publishTime\":\""+t2+"\",\"serverTime\":\""+t1+"\",\"startDate\":\""+t3+"\"}",text);

Expand Down

0 comments on commit fa95cf7

Please sign in to comment.