Changeset 13497 in josm for trunk/test
- Timestamp:
- 2018-03-04T15:18:05+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java
r12479 r13497 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 5 6 import static org.junit.Assert.assertTrue; 6 7 … … 14 15 import org.junit.Test; 15 16 import org.openstreetmap.josm.data.coor.LatLon; 17 import org.openstreetmap.josm.data.osm.DataSet.DownloadPolicy; 16 18 import org.openstreetmap.josm.data.osm.DataSet.UploadPolicy; 17 19 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 194 196 } 195 197 198 /** 199 * Unit test for {@link DataSet#mergeFrom} - Policies. 200 */ 201 @Test 202 public void testMergePolicies() { 203 DataSet ds1 = new DataSet(); 204 DataSet ds2 = new DataSet(); 205 206 ds1.setUploadPolicy(UploadPolicy.BLOCKED); 207 ds2.setUploadPolicy(UploadPolicy.NORMAL); 208 ds1.mergeFrom(ds2); 209 assertEquals(UploadPolicy.BLOCKED, ds1.getUploadPolicy()); 210 211 ds1.setUploadPolicy(UploadPolicy.NORMAL); 212 ds2.setUploadPolicy(UploadPolicy.BLOCKED); 213 ds1.mergeFrom(ds2); 214 assertEquals(UploadPolicy.BLOCKED, ds1.getUploadPolicy()); 215 216 ds1.setDownloadPolicy(DownloadPolicy.BLOCKED); 217 ds2.setDownloadPolicy(DownloadPolicy.NORMAL); 218 ds1.mergeFrom(ds2); 219 assertEquals(DownloadPolicy.BLOCKED, ds1.getDownloadPolicy()); 220 221 ds1.setDownloadPolicy(DownloadPolicy.NORMAL); 222 ds2.setDownloadPolicy(DownloadPolicy.BLOCKED); 223 ds1.mergeFrom(ds2); 224 assertEquals(DownloadPolicy.BLOCKED, ds1.getDownloadPolicy()); 225 226 ds2.lock(); 227 assertFalse(ds1.isLocked()); 228 assertTrue(ds2.isLocked()); 229 ds1.mergeFrom(ds2); 230 assertTrue(ds1.isLocked()); 231 } 232 196 233 private static void assertEqualsDataSet(DataSet ds1, DataSet ds2) { 197 234 assertEquals(new ArrayList<>(ds1.getNodes()), new ArrayList<>(ds2.getNodes())); … … 202 239 assertEquals(ds1.getVersion(), ds2.getVersion()); 203 240 } 241 242 /** 243 * Checks that enum values are defined in the correct order. 244 */ 245 @Test 246 public void testEnumOrder() { 247 assertTrue(DownloadPolicy.BLOCKED.compareTo(DownloadPolicy.NORMAL) > 0); 248 assertTrue(UploadPolicy.BLOCKED.compareTo(UploadPolicy.NORMAL) > 0); 249 assertTrue(UploadPolicy.BLOCKED.compareTo(UploadPolicy.DISCOURAGED) > 0); 250 assertTrue(UploadPolicy.DISCOURAGED.compareTo(UploadPolicy.NORMAL) > 0); 251 } 204 252 }
Note:
See TracChangeset
for help on using the changeset viewer.