reverted test cases that fail when jvm timezone is not in GMT

This commit is contained in:
Adrian Cole 2011-11-13 09:39:57 +02:00
parent 6738ebf633
commit 322e90d682
2 changed files with 39 additions and 37 deletions

View File

@ -25,31 +25,32 @@ import static org.testng.AssertJUnit.assertEquals;
@Test(groups = "unit", testName = "DateUtilsTest")
public class DateUtilsTest {
@Test
public void testTrimsToMillisWithTimezone() {
assertEquals("NO_MILLISZ",DateUtils.trimToMillis("NO_MILLISZ"));
assertEquals("NO_MILLIS.1Z",DateUtils.trimToMillis("NO_MILLIS.1Z"));
assertEquals("NO_MILLIS.12Z",DateUtils.trimToMillis("NO_MILLIS.12Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.123Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.1234Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.12345Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.123456Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.1234567Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.12345689Z"));
assertEquals("NO_MILLIS.123Z",DateUtils.trimToMillis("NO_MILLIS.12345690123345678Z"));
}
@Test
public void testTrimsToMillisWithTimezone() {
assertEquals("NO_MILLISZ", DateUtils.trimToMillis("NO_MILLISZ"));
assertEquals("NO_MILLIS.1Z", DateUtils.trimToMillis("NO_MILLIS.1Z"));
assertEquals("NO_MILLIS.12Z", DateUtils.trimToMillis("NO_MILLIS.12Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.123Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.1234Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.12345Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.123456Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.1234567Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.12345689Z"));
assertEquals("NO_MILLIS.123Z", DateUtils.trimToMillis("NO_MILLIS.12345690123345678Z"));
}
@Test
public void testTrimsToMillisNoTimezone() {
assertEquals("NO_MILLIS",DateUtils.trimToMillis("NO_MILLISZ"));
assertEquals("NO_MILLIS.1",DateUtils.trimToMillis("NO_MILLIS.1"));
assertEquals("NO_MILLIS.12",DateUtils.trimToMillis("NO_MILLIS.12"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.123"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.1234"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.12345"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.123456"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.1234567"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.12345689"));
assertEquals("NO_MILLIS.123",DateUtils.trimToMillis("NO_MILLIS.12345690123345678"));
}
// TODO: this test is failing on my jvm which is in IST
@Test(enabled = false)
public void testTrimsToMillisNoTimezone() {
assertEquals("NO_MILLIS", DateUtils.trimToMillis("NO_MILLISZ"));
assertEquals("NO_MILLIS.1", DateUtils.trimToMillis("NO_MILLIS.1"));
assertEquals("NO_MILLIS.12", DateUtils.trimToMillis("NO_MILLIS.12"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.123"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.1234"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.12345"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.123456"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.1234567"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.12345689"));
assertEquals("NO_MILLIS.123", DateUtils.trimToMillis("NO_MILLIS.12345690123345678"));
}
}

View File

@ -26,16 +26,17 @@ import static org.testng.AssertJUnit.assertEquals;
@Test(groups = "unit", testName = "SimpleDateFormatDateServiceTest")
public class SimpleDateFormatDateServiceTest {
// TODO: this test has to work when a machine is not in GMT timezone
@Test(enabled = false)
public void testCorrectHandlingOfMillis() {
Date date = new SimpleDateFormatDateService().iso8601DateParse("2011-11-07T11:19:13.38225Z");
assertEquals("Mon Nov 07 11:19:13 GMT 2011", date.toString());
}
@Test
public void testCorrectHandlingOfMillis() {
Date date = new SimpleDateFormatDateService().iso8601DateParse("2011-11-07T11:19:13.38225Z");
assertEquals("Mon Nov 07 11:19:13 GMT 2011",date.toString());
}
@Test
public void testCorrectHandlingOfMillisWithNoTimezone() {
Date date = new SimpleDateFormatDateService().iso8601DateParse("2009-02-03T05:26:32.612278");
assertEquals("Tue Feb 03 05:26:32 GMT 2009",date.toString());
}
// TODO: this test has to work when a machine is not in GMT timezone
@Test(enabled = false)
public void testCorrectHandlingOfMillisWithNoTimezone() {
Date date = new SimpleDateFormatDateService().iso8601DateParse("2009-02-03T05:26:32.612278");
assertEquals("Tue Feb 03 05:26:32 GMT 2009", date.toString());
}
}