Skip to content

Commit

Permalink
fix testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Jan 22, 2025
1 parent a2c4908 commit 6d754e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,29 @@

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.annotation.JSONCompiled;
import org.junit.After;
import org.junit.Before;
import org.junit.jupiter.api.Test;

import java.util.TimeZone;

import static org.junit.jupiter.api.Assertions.assertEquals;

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
public void test() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
Bean bean = new Bean();
bean.v01 = new java.util.Date();
bean.v02 = java.util.Calendar.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@

import com.alibaba.fastjson2.JSON;
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 java.util.*;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class UtilTypeTest {
@BeforeAll
static void setUp() {
private TimeZone timeZone;
@Before
public void setUp() {
timeZone = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}

@After
public void tearDown() {
TimeZone.setDefault(timeZone);
}

@Test
public void test() {
Bean bean = new Bean();
Expand Down

0 comments on commit 6d754e8

Please sign in to comment.