- Timestamp:
- 2016-04-03T19:25:25+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/history/CoordinateInfoViewerTest.java
r9958 r10108 4 4 import static org.junit.Assert.assertNotNull; 5 5 6 import org.junit.BeforeClass; 6 7 import org.junit.Test; 8 import org.openstreetmap.josm.JOSMFixture; 7 9 8 10 /** … … 10 12 */ 11 13 public class CoordinateInfoViewerTest { 14 15 /** 16 * Setup test. 17 */ 18 @BeforeClass 19 public static void setUpBeforeClass() { 20 JOSMFixture.createUnitTestFixture().init(); 21 } 12 22 13 23 /** -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java
r9958 r10108 6 6 import java.util.Date; 7 7 8 import org.junit.BeforeClass; 8 9 import org.junit.Test; 10 import org.openstreetmap.josm.JOSMFixture; 9 11 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 10 12 import org.openstreetmap.josm.data.osm.User; … … 19 21 */ 20 22 public class HistoryBrowserDialogTest { 23 24 /** 25 * Setup test. 26 */ 27 @BeforeClass 28 public static void setUpBeforeClass() { 29 JOSMFixture.createUnitTestFixture().init(); 30 } 21 31 22 32 /** -
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r10103 r10108 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotEquals; 6 import static org.junit.Assert.assertNotNull; 5 7 6 8 import java.text.DateFormat; … … 116 118 assertEquals("1:00:00 AM CET", DateUtils.formatTime(new Date(123), DateFormat.LONG)); 117 119 } 120 121 /** 122 * Unit test of {@link DateUtils#formatDate} method. 123 */ 124 @Test 125 public void testFormatDate() { 126 assertEquals("1/1/70", DateUtils.formatDate(new Date(123), DateFormat.SHORT)); 127 assertEquals("January 1, 1970", DateUtils.formatDate(new Date(123), DateFormat.LONG)); 128 } 129 130 /** 131 * Unit test of {@link DateUtils#tsFromString} method. 132 */ 133 @Test 134 public void testTsFromString() { 135 // UTC times 136 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00Z")); 137 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00")); 138 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03 15:00:00 UTC")); 139 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00+00")); 140 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00-00")); 141 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00+00:00")); 142 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00-00:00")); 143 144 // UTC times with millis 145 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00.000Z")); 146 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00.000")); 147 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00.000+00:00")); 148 assertEquals(1459695600000L, DateUtils.tsFromString("2016-04-03T15:00:00.000-00:00")); 149 150 // Local time 151 assertEquals(1459688400000L, DateUtils.tsFromString("03-APR-16 15:00:00")); 152 } 153 154 /** 155 * Unit test of {@link DateUtils#getDateFormat} method. 156 */ 157 @Test 158 public void testGetDateFormat() { 159 Boolean iso = DateUtils.PROP_ISO_DATES.get(); 160 try { 161 DateFormat f1 = DateUtils.getDateFormat(DateFormat.SHORT); 162 assertNotNull(f1); 163 DateUtils.PROP_ISO_DATES.put(!iso); 164 DateFormat f2 = DateUtils.getDateFormat(DateFormat.SHORT); 165 assertNotNull(f1); 166 assertNotEquals(f1, f2); 167 } finally { 168 DateUtils.PROP_ISO_DATES.put(iso); 169 } 170 } 171 172 /** 173 * Unit test of {@link DateUtils#getTimeFormat} method. 174 */ 175 @Test 176 public void testTimeFormat() { 177 Boolean iso = DateUtils.PROP_ISO_DATES.get(); 178 try { 179 DateFormat f1 = DateUtils.getTimeFormat(DateFormat.SHORT); 180 assertNotNull(f1); 181 DateUtils.PROP_ISO_DATES.put(!iso); 182 DateFormat f2 = DateUtils.getTimeFormat(DateFormat.SHORT); 183 assertNotNull(f1); 184 assertNotEquals(f1, f2); 185 } finally { 186 DateUtils.PROP_ISO_DATES.put(iso); 187 } 188 } 118 189 }
Note:
See TracChangeset
for help on using the changeset viewer.