BAEL-3302: Fix package name & get rid of 3-letter time zone

This commit is contained in:
Kert Pjatkin 2019-12-02 01:58:50 +02:00
parent dfb9ae68a6
commit a3eabf82a8
2 changed files with 4 additions and 9 deletions

View File

@ -1,9 +1,8 @@
package com.baeldung.timezone;
package com.baeldung.jvmtimezone;
import org.junit.Test;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import static org.junit.Assert.assertEquals;
@ -13,9 +12,7 @@ public class ModifyDefaultTimezoneUnitTest {
@Test
public void givenDefaultTimezoneSet_thenDateTimezoneIsCorrect() {
TimeZone.setDefault(TimeZone.getTimeZone("Portugal"));
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("Portugal"));
}

View File

@ -1,4 +1,4 @@
package com.baeldung.timezone;
package com.baeldung.jvmtimezone;
import org.junit.After;
import org.junit.Before;
@ -14,7 +14,7 @@ public class ModifyTimezonePropertyUnitTest {
@Before
public void setup() {
System.setProperty("user.timezone", "IST");
System.setProperty("user.timezone", "Asia/Kolkata");
TimeZone.setDefault(null);
}
@ -25,10 +25,8 @@ public class ModifyTimezonePropertyUnitTest {
@Test
public void givenTimezonePropertySet_thenDateTimezoneIsCorrect() {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("IST"));
assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("Asia/Kolkata"));
}
}