如何使这个单元测试在所有时区都通过,而不管 DST 是否处于活动状态?
import static org.junit.Assert.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.joda.time.DateTime;
import org.junit.Test;
public class TimeZoneTest {
private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat( "yyyy.MM.dd'T'HH:mm.ss:SSSZZ" );
@Test
public void testUtilDateMillis() throws Exception {
assertEquals( "1970.01.01T00:00.00:000+0000", DATE_FORMAT.format( new Date( 0L ) ) );
}
@Test
public void testDateTimeMillis() throws Exception {
assertEquals( "1970-01-01T00:00:00.000+00:00", new DateTime( 0L ).toString() );
}
}