diff options
Diffstat (limited to 'harmony-tests/src/test')
3 files changed, 20 insertions, 9 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java index 0920714..e666c97 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/MessageFormatTest.java @@ -184,6 +184,9 @@ public class MessageFormatTest extends TestCase { } public void test_parseLjava_lang_String() throws ParseException { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; + String pattern = "A {3, number, currency} B {2, time} C {0, number, percent} D {4} E {1,choice,0#off|1#on} F {0, date}"; MessageFormat mf = new MessageFormat(pattern); String sToParse = "A $12,345.00 B 9:56:07 AM C 3,200% D 1/15/70 9:56 AM E on F Jan 1, 1970"; diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java index 8003b88..b8b0cee 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/Support_MessageFormat.java @@ -44,6 +44,8 @@ public class Support_MessageFormat extends Support_Format { } public void t_format_with_FieldPosition() { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; String pattern = "On {4,date} at {3,time}, he ate {2,number, integer} hamburger{2,choice,1#|1<s} and drank {1, number} liters of coke. That was {0,choice,1#just enough|1<more than enough} food!"; MessageFormat format = new MessageFormat(pattern, Locale.US); @@ -71,6 +73,9 @@ public class Support_MessageFormat extends Support_Format { } public void t_formatToCharacterIterator() { + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; + String pattern = "On {4,date} at {3,time}, he ate {2,number, integer} hamburger{2,choice,1#|1<s} and drank {1, number} liters of coke. That was {0,choice,1#just enough|1<more than enough} food!"; MessageFormat format = new MessageFormat(pattern, Locale.US); diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/DateTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/DateTest.java index 0ce971d..f3ad743 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/DateTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/DateTest.java @@ -17,6 +17,7 @@ package org.apache.harmony.tests.java.util; +import java.text.DateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -487,18 +488,20 @@ public class DateTest extends junit.framework.TestCase { public void test_toLocaleString() { Locale loc = Locale.getDefault(); Locale.setDefault(Locale.US); - TimeZone tz = TimeZone.getDefault(); - TimeZone.setDefault(TimeZone.getTimeZone("GMT")); - try { + TimeZone tz = TimeZone.getDefault(); + TimeZone.setDefault(TimeZone.getTimeZone("GMT")); + // This test assumes a default DateFormat.is24Hour setting. + DateFormat.is24Hour = null; + try { assertEquals("Did not convert epoch to GMT string correctly", "Jan 1, 1970 12:00:00 AM", - new Date(0).toLocaleString()); + new Date(0).toLocaleString()); assertEquals("Did not convert epoch + 1yr to GMT string correctly", - "Jan 1, 1971 12:00:00 AM", new Date((long)365 * 24 * 60 * 60 * 1000) - .toLocaleString()); - } finally { + "Jan 1, 1971 12:00:00 AM", + new Date((long)365 * 24 * 60 * 60 * 1000).toLocaleString()); + } finally { Locale.setDefault(loc); - TimeZone.setDefault(tz); - } + TimeZone.setDefault(tz); + } } static TimeZone defaultTimeZone = TimeZone.getDefault(); |