Changeset 17717 in josm for trunk/test
- Timestamp:
- 2021-04-09T00:19:53+02:00 (3 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java
r17275 r17717 8 8 import static org.openstreetmap.josm.data.osm.Changeset.MAX_CHANGESET_TAG_LENGTH; 9 9 10 import java.util.Calendar; 10 import java.time.Duration; 11 import java.time.Instant; 11 12 import java.util.Collection; 12 import java.util.Date;13 13 import java.util.HashMap; 14 14 import java.util.Map; … … 138 138 } 139 139 140 private static Date yesterday() {141 final Calendar cal = Calendar.getInstance();142 cal.add(Calendar.DATE, -1);143 return cal.getTime();144 }145 146 140 /** 147 141 * Unit test of method {@link Changeset#hasEqualSemanticAttributes}. … … 149 143 @Test 150 144 void testHasEqualSemanticAttributes() { 151 Date today = new Date(); 145 Instant today = Instant.now(); 146 Instant yesterday = today.minus(Duration.ofDays(1)); 152 147 Changeset cs1 = new Changeset(); 153 148 Changeset cs2 = new Changeset(); … … 158 153 cs2.setClosedAt(today); 159 154 assertFalse(cs1.hasEqualSemanticAttributes(cs2)); 160 cs1.setClosedAt(yesterday ());155 cs1.setClosedAt(yesterday); 161 156 cs2.setClosedAt(today); 162 157 assertFalse(cs1.hasEqualSemanticAttributes(cs2)); … … 168 163 cs2.setCreatedAt(today); 169 164 assertFalse(cs1.hasEqualSemanticAttributes(cs2)); 170 cs1.setCreatedAt(yesterday ());165 cs1.setCreatedAt(yesterday); 171 166 cs2.setCreatedAt(today); 172 167 assertFalse(cs1.hasEqualSemanticAttributes(cs2)); -
trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetCellRendererTest.java
r17275 r17717 12 12 13 13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 14 15 import java.time.Instant; 14 16 15 17 /** … … 31 33 JList<Changeset> list = new JList<>(); 32 34 Changeset cs = new Changeset(); 35 cs.setCreatedAt(Instant.EPOCH); 33 36 ChangesetCellRenderer c = new ChangesetCellRenderer(); 34 37 assertEquals(c, c.getListCellRendererComponent(list, cs, 0, false, false)); -
trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java
r17275 r17717 11 11 import java.io.StringWriter; 12 12 import java.nio.charset.StandardCharsets; 13 import java.time.Instant; 13 14 import java.util.ArrayList; 14 15 import java.util.Arrays; … … 16 17 import java.util.List; 17 18 19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 18 20 import org.junit.jupiter.api.Test; 21 import org.junit.jupiter.api.extension.RegisterExtension; 19 22 import org.openstreetmap.josm.data.coor.LatLon; 20 23 import org.openstreetmap.josm.data.osm.Changeset; … … 24 27 import org.openstreetmap.josm.data.osm.UploadPolicy; 25 28 import org.openstreetmap.josm.data.osm.User; 29 import org.openstreetmap.josm.testutils.JOSMTestRules; 26 30 27 31 /** … … 29 33 */ 30 34 class OsmWriterTest { 35 36 /** 37 * Setup rule 38 */ 39 @RegisterExtension 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 public JOSMTestRules test = new JOSMTestRules(); 31 42 32 43 /** … … 107 118 cs.setMin(new LatLon(12., 34.)); 108 119 cs.setMax(new LatLon(56., 78.)); 120 cs.setCreatedAt(Instant.EPOCH); 109 121 try (StringWriter stringWriter = new StringWriter(); 110 122 OsmWriter osmWriter = OsmWriterFactory.createOsmWriter(new PrintWriter(stringWriter), true, OsmWriter.DEFAULT_API_VERSION)) { 111 123 osmWriter.visit(cs); 112 assertEquals(" <changeset id='38038262' user='<anonymous>' uid='-1' open='false' " +124 assertEquals(" <changeset id='38038262' user='<anonymous>' uid='-1' created_at='1970-01-01T00:00:00Z' open='false' " + 113 125 "min_lon='34.0' min_lat='12.0' max_lon='78.0' max_lat='56.0'>\n </changeset>\n", 114 126 stringWriter.toString().replace("\r", ""));
Note:
See TracChangeset
for help on using the changeset viewer.