Bug 1268525 - review: Add test for non GMT time zone. r=me

MozReview-Commit-ID: 1VaPm3ywjZQ

--HG--
extra : rebase_source : 5990a97cfd517352604d2d7a45565f8e14048e6b
This commit is contained in:
Michael Comella 2016-05-09 11:20:08 -07:00
parent d5cd4d33f2
commit 3db65a2f2d

View File

@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
@RunWith(TestRunner.class)
public class TestDateUtil {
@Test
public void testGetDateInHTTPFormat() {
public void testGetDateInHTTPFormatGMT() {
final TimeZone gmt = TimeZone.getTimeZone("GMT");
final GregorianCalendar calendar = new GregorianCalendar(gmt, Locale.US);
calendar.set(2011, Calendar.FEBRUARY, 1, 14, 0, 0);
@ -32,4 +32,15 @@ public class TestDateUtil {
final String actualDate = DateUtil.getDateInHTTPFormat(calendar.getTime());
assertEquals("Returned date is expected", expectedDate, actualDate);
}
@Test
public void testGetDateInHTTPFormatNonGMT() {
final TimeZone kst = TimeZone.getTimeZone("Asia/Seoul"); // no daylight savings time.
final GregorianCalendar calendar = new GregorianCalendar(kst, Locale.US);
calendar.set(2011, Calendar.FEBRUARY, 1, 14, 0, 0);
final String expectedDate = "Tue, 01 Feb 2011 05:00:00 GMT";
final String actualDate = DateUtil.getDateInHTTPFormat(calendar.getTime());
assertEquals("Returned date is expected", expectedDate, actualDate);
}
}