mirror of https://github.com/alibaba/fastjson2.git
fix testcase
This commit is contained in:
parent
a2c49087f5
commit
6d754e8500
|
|
@ -2,6 +2,8 @@ package com.alibaba.fastjson2.internal.processor.primitives;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.annotation.JSONCompiled;
|
import com.alibaba.fastjson2.annotation.JSONCompiled;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
@ -9,9 +11,20 @@ import java.util.TimeZone;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class DateTypeTest {
|
public class DateTypeTest {
|
||||||
|
private TimeZone timeZone;
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
timeZone = TimeZone.getDefault();
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
TimeZone.setDefault(timeZone);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
||||||
Bean bean = new Bean();
|
Bean bean = new Bean();
|
||||||
bean.v01 = new java.util.Date();
|
bean.v01 = new java.util.Date();
|
||||||
bean.v02 = java.util.Calendar.getInstance();
|
bean.v02 = java.util.Calendar.getInstance();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ package com.alibaba.fastjson2.internal.processor.primitives;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.annotation.JSONCompiled;
|
import com.alibaba.fastjson2.annotation.JSONCompiled;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -10,11 +11,18 @@ import java.util.*;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class UtilTypeTest {
|
public class UtilTypeTest {
|
||||||
@BeforeAll
|
private TimeZone timeZone;
|
||||||
static void setUp() {
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
timeZone = TimeZone.getDefault();
|
||||||
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
|
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
TimeZone.setDefault(timeZone);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
Bean bean = new Bean();
|
Bean bean = new Bean();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue