Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
add testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Sep 19, 2019
1 parent 9950f34 commit 8b251cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/test/java/com/alibaba/json/bvt/SqlDateTest1.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ public void test_date2() throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date d = sdf.parse("2019-09-12 16:00:00");
java.sql.Date ds = new java.sql.Date(d.getTime());
System.out.println("Java Obj: " + sdf.format(ds));
// System.out.println("Java Obj: " + sdf.format(ds));

String jvs = JSON.toJSONString(ds);
System.out.println("JSON Str: " + jvs);
// System.out.println("JSON Str: " + jvs);

java.sql.Date d2s = JSON.parseObject(jvs, java.sql.Date.class);
System.out.println("Java Obj: " + sdf.format(d2s));
System.out.println("LONG: " + d2s.getTime());
// System.out.println("Java Obj: " + sdf.format(d2s));
// System.out.println("LONG: " + d2s.getTime());

assertEquals(d.getTime(), d2s.getTime());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ public void test_2() throws Exception {
assertNotNull(value);
}

public void test_3() throws Exception {
Exception ex = (Exception) JSON.parseObject("{\"@type\":\"org.springframework.dao.CannotAcquireLockException\",\"message\":\"xxx\"}", Object.class);
assertEquals("xxx", ex.getMessage());
}

}

0 comments on commit 8b251cb

Please sign in to comment.