Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r10475 r10483 134 134 // example date format "18-AUG-08 13:33:03" 135 135 SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yy HH:mm:ss"); 136 f.setTimeZone(calendarLocale.getTimeZone()); 136 137 Date d = f.parse(str, new ParsePosition(0)); 137 138 if (d != null) -
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r10222 r10483 10 10 import java.util.TimeZone; 11 11 12 import org.junit. BeforeClass;12 import org.junit.Rule; 13 13 import org.junit.Test; 14 import org.openstreetmap.josm. JOSMFixture;14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 15 import org.openstreetmap.josm.tools.UncheckedParseException; 16 16 … … 23 23 24 24 /** 25 * Setup test. 26 */ 27 @BeforeClass 28 public static void setUp() { 29 JOSMFixture.createUnitTestFixture().init(); 30 } 25 * Set the timezone and timeout. 26 */ 27 @Rule 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 public JOSMTestRules test = new JOSMTestRules().i18n().preferences(); 31 30 32 31 /** … … 117 116 @Test 118 117 public void testFormatTime() { 119 assertEquals("1:00 AM", DateUtils.formatTime(new Date(123), DateFormat.SHORT)); 120 assertEquals("1:00:00 AM CET", DateUtils.formatTime(new Date(123), DateFormat.LONG)); 118 assertEquals("12:00 AM", DateUtils.formatTime(new Date(0), DateFormat.SHORT)); 119 assertEquals("1:00 AM", DateUtils.formatTime(new Date(60 * 60 * 1000), DateFormat.SHORT)); 120 assertEquals("12:00 AM", DateUtils.formatTime(new Date(999), DateFormat.SHORT)); 121 // ignore seconds 122 assertEquals("12:00 AM", DateUtils.formatTime(new Date(5999), DateFormat.SHORT)); 123 124 TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); 125 assertEquals("1:00:00 AM CET", DateUtils.formatTime(new Date(0), DateFormat.LONG)); 121 126 } 122 127
Note:
See TracChangeset
for help on using the changeset viewer.