fix ObjectViewTest TimeZone problem.

This commit is contained in:
hengyunabc 2018-09-30 16:18:56 +08:00
parent 86d1d4bfb7
commit da4f2172da

View File

@ -8,6 +8,7 @@ import java.util.Date;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone;
/** /**
* @author ralf0131 2018-07-10 10:55. * @author ralf0131 2018-07-10 10:55.
@ -190,13 +191,14 @@ public class ObjectViewTest {
@Test @Test
public void testDate() { public void testDate() {
Date d = new Date(1531204354961L); Date d = new Date(1531204354961L - TimeZone.getDefault().getRawOffset()
+ TimeZone.getTimeZone("GMT+8").getRawOffset());
ObjectView objectView = new ObjectView(d, 3); ObjectView objectView = new ObjectView(d, 3);
String expected = "@Date[2018-07-10 14:32:34,961]"; String expected = "@Date[2018-07-10 14:32:34,961]";
Assert.assertEquals(expected, objectView.draw()); Assert.assertEquals(expected, objectView.draw());
} }
@Test @Test
public void testNestedClass() { public void testNestedClass() {
ObjectView objectView = new ObjectView(new NestedClass(100), 3); ObjectView objectView = new ObjectView(new NestedClass(100), 3);