diff --git a/src/org/openstreetmap/josm/tools/date/DateUtils.java b/src/org/openstreetmap/josm/tools/date/DateUtils.java
index 3cbb811..c148194 100644
|
a
|
b
|
public final class DateUtils {
|
| 133 | 133 | } else { |
| 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) |
| 138 | 139 | return d.getTime(); |
diff --git a/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java b/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
index 43f6fff..90440ec 100644
|
a
|
b
|
import java.text.DateFormat;
|
| 9 | 9 | import java.util.Date; |
| 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 | |
| 17 | 17 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| … |
… |
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
| 22 | 22 | public class DateUtilsTest { |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | | * Setup test. |
| | 25 | * Set the timezone and timeout. |
| 26 | 26 | */ |
| 27 | | @BeforeClass |
| 28 | | public static void setUp() { |
| 29 | | JOSMFixture.createUnitTestFixture().init(); |
| 30 | | } |
| | 27 | @Rule |
| | 28 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| | 29 | public JOSMTestRules test = new JOSMTestRules().i18n().preferences(); |
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Allows to override the timezone used in {@link DateUtils} for unit tests. |
| … |
… |
public class DateUtilsTest {
|
| 116 | 115 | */ |
| 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 | |
| 123 | 128 | /** |