Changeset 18578 in josm for trunk/test/unit
- Timestamp:
- 2022-10-18T00:43:38+02:00 (2 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/LayersTest.java
r17879 r18578 62 62 void testFill() { 63 63 // Test a layer without a source (should fail) 64 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()64 JsonObject emptyFill = Json.createObjectBuilder() 65 65 .add("type", Layers.Type.FILL.name()) 66 .add("id", "Empty Fill").build())); 66 .add("id", "Empty Fill").build(); 67 assertThrows(NullPointerException.class, () -> new Layers(emptyFill)); 67 68 68 69 // Test an empty fill layer … … 118 119 void testLine() { 119 120 // Test a layer without a source (should fail) 120 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder() 121 .add("type", Layers.Type.LINE.name()) 122 .add("id", "Empty Line").build())); 121 JsonObject emptyLine = Json.createObjectBuilder() 122 .add("type", Layers.Type.RASTER.name()) 123 .add("id", "Empty Raster").build(); 124 assertThrows(NullPointerException.class, () -> new Layers(emptyLine)); 123 125 124 126 JsonObject allLayoutProperties = Json.createObjectBuilder() … … 173 175 void testSymbol() { 174 176 // Test a layer without a source (should fail) 175 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder() 176 .add("type", Layers.Type.SYMBOL.name()) 177 .add("id", "Empty Symbol").build())); 177 JsonObject emptySymbol = Json.createObjectBuilder() 178 .add("type", Layers.Type.RASTER.name()) 179 .add("id", "Empty Raster").build(); 180 assertThrows(NullPointerException.class, () -> new Layers(emptySymbol)); 178 181 179 182 JsonObject allPaintProperties = Json.createObjectBuilder() … … 306 309 void testRaster() { 307 310 // Test a layer without a source (should fail) 308 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()311 JsonObject emptyRaster = Json.createObjectBuilder() 309 312 .add("type", Layers.Type.RASTER.name()) 310 .add("id", "Empty Raster").build())); 313 .add("id", "Empty Raster").build(); 314 assertThrows(NullPointerException.class, () -> new Layers(emptyRaster)); 311 315 312 316 JsonObject allPaintProperties = Json.createObjectBuilder() … … 349 353 void testCircle() { 350 354 // Test a layer without a source (should fail) 351 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()355 JsonObject emptyCircle = Json.createObjectBuilder() 352 356 .add("type", Layers.Type.CIRCLE.name()) 353 .add("id", "Empty Circle").build())); 357 .add("id", "Empty Circle").build(); 358 assertThrows(NullPointerException.class, () -> new Layers(emptyCircle)); 354 359 355 360 JsonObject allPaintProperties = Json.createObjectBuilder() … … 400 405 void testFillExtrusion() { 401 406 // Test a layer without a source (should fail) 402 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()407 JsonObject emptyFillExtrusion = Json.createObjectBuilder() 403 408 .add("type", Layers.Type.FILL_EXTRUSION.name()) 404 .add("id", "Empty Fill Extrusion").build())); 409 .add("id", "Empty Fill Extrusion").build(); 410 assertThrows(NullPointerException.class, () -> new Layers(emptyFillExtrusion)); 405 411 406 412 JsonObject allPaintProperties = Json.createObjectBuilder() … … 439 445 void testHeatmap() { 440 446 // Test a layer without a source (should fail) 441 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()447 JsonObject emptyHeatmap = Json.createObjectBuilder() 442 448 .add("type", Layers.Type.HEATMAP.name()) 443 .add("id", "Empty Heatmap").build())); 449 .add("id", "Empty Heatmap").build(); 450 assertThrows(NullPointerException.class, () -> new Layers(emptyHeatmap)); 444 451 445 452 JsonObject allPaintProperties = Json.createObjectBuilder() … … 476 483 void testHillshade() { 477 484 // Test a layer without a source (should fail) 478 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()485 JsonObject emptyHillshade = Json.createObjectBuilder() 479 486 .add("type", Layers.Type.HILLSHADE.name()) 480 .add("id", "Empty Hillshade").build())); 487 .add("id", "Empty Hillshade").build(); 488 assertThrows(NullPointerException.class, () -> new Layers(emptyHillshade)); 481 489 482 490 JsonObject allPaintProperties = Json.createObjectBuilder() … … 516 524 void testSky() { 517 525 // Test a layer without a source (should fail) 518 assertThrows(NullPointerException.class, () -> new Layers(Json.createObjectBuilder()526 JsonObject emptySky = Json.createObjectBuilder() 519 527 .add("type", Layers.Type.SKY.name()) 520 .add("id", "Empty Sky").build())); 528 .add("id", "Empty Sky").build(); 529 assertThrows(NullPointerException.class, () -> new Layers(emptySky)); 521 530 522 531 JsonObject allPaintProperties = Json.createObjectBuilder() … … 580 589 .add("maxzoom", 24) 581 590 .build()); 582 assertEquals(MessageFormat.format(baseString, "|z-2 4"), maxZoomLayer.toString());591 assertEquals(MessageFormat.format(baseString, "|z-23"), maxZoomLayer.toString()); 583 592 584 593 Layers minMaxZoomLayer = new Layers(Json.createObjectBuilder(baseInformation) 585 594 .add("minzoom", 1) 586 .add("maxzoom", 2)595 .add("maxzoom", 3) 587 596 .build()); 588 597 assertEquals(MessageFormat.format(baseString, "|z1-2"), minMaxZoomLayer.toString()); … … 593 602 .build()); 594 603 assertEquals(MessageFormat.format(baseString, "|z2"), sameMinMaxZoomLayer.toString()); 604 Layers zeroMaxZoom = new Layers(Json.createObjectBuilder(baseInformation) 605 .add("maxzoom", 0) 606 .build()); 607 assertEquals(MessageFormat.format(baseString, "|z-0"), zeroMaxZoom.toString()); 595 608 } 596 609 -
trunk/test/unit/org/openstreetmap/josm/data/vector/VectorWayTest.java
r18037 r18578 87 87 assertFalse(way.isClosed()); 88 88 assertEquals(OsmPrimitiveType.WAY, way.getType()); 89 assertEquals(OsmPrimitiveType.WAY, way.getDisplayType()); 89 90 List<VectorNode> nodes = new ArrayList<>(way.getNodes()); 90 91 nodes.add(nodes.get(0)); 91 92 way.setNodes(nodes); 92 93 assertTrue(way.isClosed()); 93 assertEquals(OsmPrimitiveType.CLOSEDWAY, way.getType()); 94 assertEquals(OsmPrimitiveType.WAY, way.getType()); 95 assertEquals(OsmPrimitiveType.CLOSEDWAY, way.getDisplayType()); 94 96 } 95 97
Note:
See TracChangeset
for help on using the changeset viewer.