fix sonar warnings in tests (#191)

This commit is contained in:
Michael Barry
2022-04-23 06:36:24 -04:00
committed by GitHub
parent 644ea4b4cf
commit 3500ee0240
20 changed files with 196 additions and 196 deletions

View File

@@ -11,7 +11,7 @@ import com.onthegomap.planetiler.util.Wikidata;
import java.util.List;
import org.junit.jupiter.api.Test;
public class BasemapProfileTest {
class BasemapProfileTest {
private final Wikidata.WikidataTranslations wikidataTranslations = new Wikidata.WikidataTranslations();
private final Translations translations = Translations.defaultProvider(List.of("en", "es", "de"))
@@ -20,7 +20,7 @@ public class BasemapProfileTest {
Stats.inMemory());
@Test
public void testCaresAboutWikidata() {
void testCaresAboutWikidata() {
var node = new OsmElement.Node(1, 1, 1);
node.setTag("aeroway", "gate");
assertTrue(profile.caresAboutWikidataTranslation(node));
@@ -30,7 +30,7 @@ public class BasemapProfileTest {
}
@Test
public void testDoesntCareAboutWikidataForRoads() {
void testDoesntCareAboutWikidataForRoads() {
var way = new OsmElement.Way(1);
way.setTag("highway", "footway");
assertFalse(profile.caresAboutWikidataTranslation(way));

View File

@@ -35,7 +35,7 @@ import org.locationtech.jts.geom.Polygon;
* Generates an entire map for the smallest openstreetmap extract available (Monaco) and asserts that expected output
* features exist
*/
public class BasemapTest {
class BasemapTest {
@TempDir
static Path tmpDir;
@@ -67,7 +67,7 @@ public class BasemapTest {
}
@Test
public void testMetadata() {
void testMetadata() {
Map<String, String> metadata = mbtiles.metadata().getAll();
assertEquals("OpenMapTiles", metadata.get("name"));
assertEquals("0", metadata.get("minzoom"));
@@ -82,7 +82,7 @@ public class BasemapTest {
}
@Test
public void ensureValidGeometries() throws Exception {
void ensureValidGeometries() throws Exception {
Set<Mbtiles.TileEntry> parsedTiles = TestUtils.getAllTiles(mbtiles);
for (var tileEntry : parsedTiles) {
var decoded = VectorTile.decode(gunzip(tileEntry.bytes()));
@@ -93,14 +93,14 @@ public class BasemapTest {
}
@Test
public void testContainsOceanPolyons() {
void testContainsOceanPolyons() {
assertFeatureNear(mbtiles, "water", Map.of(
"class", "ocean"
), 7.4484, 43.70783, 0, 14);
}
@Test
public void testContainsCountryName() {
void testContainsCountryName() {
assertFeatureNear(mbtiles, "place", Map.of(
"class", "country",
"iso_a2", "MC",
@@ -109,7 +109,7 @@ public class BasemapTest {
}
@Test
public void testContainsSuburb() {
void testContainsSuburb() {
assertFeatureNear(mbtiles, "place", Map.of(
"name", "Les Moneghetti",
"class", "suburb"
@@ -117,14 +117,14 @@ public class BasemapTest {
}
@Test
public void testContainsBuildings() {
void testContainsBuildings() {
assertFeatureNear(mbtiles, "building", Map.of(), 7.41919, 43.73401, 13, 14);
assertNumFeatures("building", Map.of(), 14, 1316, Polygon.class);
assertNumFeatures("building", Map.of(), 13, 196, Polygon.class);
}
@Test
public void testContainsHousenumber() {
void testContainsHousenumber() {
assertFeatureNear(mbtiles, "housenumber", Map.of(
"housenumber", "27"
), 7.42117, 43.73652, 14, 14);
@@ -132,7 +132,7 @@ public class BasemapTest {
}
@Test
public void testBoundary() {
void testBoundary() {
assertFeatureNear(mbtiles, "boundary", Map.of(
"admin_level", 2L,
"maritime", 1L,
@@ -141,7 +141,7 @@ public class BasemapTest {
}
@Test
public void testAeroway() {
void testAeroway() {
assertNumFeatures("aeroway", Map.of(
"class", "heliport"
), 14, 1, Polygon.class);
@@ -151,7 +151,7 @@ public class BasemapTest {
}
@Test
public void testLandcover() {
void testLandcover() {
assertNumFeatures("landcover", Map.of(
"class", "grass",
"subclass", "park"
@@ -163,7 +163,7 @@ public class BasemapTest {
}
@Test
public void testPoi() {
void testPoi() {
assertNumFeatures("poi", Map.of(
"class", "restaurant",
"subclass", "restaurant"
@@ -175,7 +175,7 @@ public class BasemapTest {
}
@Test
public void testLanduse() {
void testLanduse() {
assertNumFeatures("landuse", Map.of(
"class", "residential"
), 14, 8, Polygon.class);
@@ -185,7 +185,7 @@ public class BasemapTest {
}
@Test
public void testTransportation() {
void testTransportation() {
assertNumFeatures("transportation", Map.of(
"class", "path",
"subclass", "footway"
@@ -196,7 +196,7 @@ public class BasemapTest {
}
@Test
public void testTransportationName() {
void testTransportationName() {
assertNumFeatures("transportation_name", Map.of(
"name", "Boulevard du Larvotto",
"class", "primary"
@@ -204,14 +204,14 @@ public class BasemapTest {
}
@Test
public void testWaterway() {
void testWaterway() {
assertNumFeatures("waterway", Map.of(
"class", "stream"
), 14, 6, LineString.class);
}
@TestFactory
public Stream<DynamicTest> testVerifyChecks() {
Stream<DynamicTest> testVerifyChecks() {
return VerifyMonaco.verify(mbtiles).results().stream()
.map(check -> dynamicTest(check.name(), () -> {
check.error().ifPresent(Assertions::fail);

View File

@@ -16,10 +16,10 @@ import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
public class GenerateTest {
class GenerateTest {
@Test
public void testParseSimple() {
void testParseSimple() {
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
key: value
@@ -36,7 +36,7 @@ public class GenerateTest {
}
@Test
public void testParseAnd() {
void testParseAnd() {
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
__AND__:
@@ -52,7 +52,7 @@ public class GenerateTest {
}
@Test
public void testParseAndWithOthers() {
void testParseAndWithOthers() {
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
- key0: val0
@@ -72,7 +72,7 @@ public class GenerateTest {
}
@Test
public void testParseAndContainingOthers() {
void testParseAndContainingOthers() {
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
__AND__:
@@ -93,7 +93,7 @@ public class GenerateTest {
}
@Test
public void testParseContainsKey() {
void testParseContainsKey() {
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
key1: val1
@@ -108,7 +108,7 @@ public class GenerateTest {
}
@TestFactory
public Stream<DynamicTest> testParseImposm3Mapping() {
Stream<DynamicTest> testParseImposm3Mapping() {
record TestCase(String name, String mapping, String require, String reject, Expression expected) {
TestCase(String mapping, Expression expected) {
@@ -184,7 +184,7 @@ public class GenerateTest {
}
@Test
public void testTypeMappingTopLevelType() {
void testTypeMappingTopLevelType() {
Expression parsed = Generate
.parseImposm3MappingExpression("point", parseYaml("""
key: val
@@ -196,7 +196,7 @@ public class GenerateTest {
}
@Test
public void testTypeMappings() {
void testTypeMappings() {
Map<String, JsonNode> props = new LinkedHashMap<>();
props.put("points", parseYaml("""
key: val

View File

@@ -5,7 +5,7 @@ import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class AerodromeLabelTest extends AbstractLayerTest {
class AerodromeLabelTest extends AbstractLayerTest {
@BeforeEach
public void setupWikidataTranslation() {
@@ -13,7 +13,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testIntlWithIata() {
void testIntlWithIata() {
assertFeatures(14, List.of(Map.of(
"class", "international",
"ele", 100,
@@ -38,7 +38,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testInternational() {
void testInternational() {
assertFeatures(14, List.of(Map.of(
"class", "international",
"_layer", "aerodrome_label",
@@ -50,7 +50,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testPublic() {
void testPublic() {
assertFeatures(14, List.of(Map.of(
"class", "public",
"_layer", "aerodrome_label",
@@ -69,7 +69,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testMilitary() {
void testMilitary() {
assertFeatures(14, List.of(Map.of(
"class", "military",
"_layer", "aerodrome_label",
@@ -88,7 +88,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testPrivate() {
void testPrivate() {
assertFeatures(14, List.of(Map.of(
"class", "private",
"_layer", "aerodrome_label",
@@ -107,7 +107,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testOther() {
void testOther() {
assertFeatures(14, List.of(Map.of(
"class", "other",
"_layer", "aerodrome_label",
@@ -118,7 +118,7 @@ public class AerodromeLabelTest extends AbstractLayerTest {
}
@Test
public void testIgnoreNonPoints() {
void testIgnoreNonPoints() {
assertFeatures(14, List.of(), process(lineFeature(Map.of(
"aeroway", "aerodrome"
))));

View File

@@ -4,10 +4,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class AerowayTest extends AbstractLayerTest {
class AerowayTest extends AbstractLayerTest {
@Test
public void aerowayGate() {
void aerowayGate() {
assertFeatures(14, List.of(Map.of(
"class", "gate",
"ref", "123",
@@ -30,7 +30,7 @@ public class AerowayTest extends AbstractLayerTest {
}
@Test
public void aerowayLine() {
void aerowayLine() {
assertFeatures(14, List.of(Map.of(
"class", "runway",
"ref", "123",
@@ -50,7 +50,7 @@ public class AerowayTest extends AbstractLayerTest {
}
@Test
public void aerowayPolygon() {
void aerowayPolygon() {
assertFeatures(14, List.of(Map.of(
"class", "runway",
"ref", "123",

View File

@@ -19,10 +19,10 @@ import java.util.Map;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
public class BoundaryTest extends AbstractLayerTest {
class BoundaryTest extends AbstractLayerTest {
@Test
public void testNaturalEarthCountryBoundaries() {
void testNaturalEarthCountryBoundaries() {
assertCoversZoomRange(
0, 4, "boundary",
process(SimpleFeature.create(
@@ -124,7 +124,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testNaturalEarthStateBoundaries() {
void testNaturalEarthStateBoundaries() {
assertFeatures(0, List.of(Map.of(
"_layer", "boundary",
"_type", "line",
@@ -184,13 +184,13 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testMergesDisconnectedLineFeatures() throws GeometryException {
void testMergesDisconnectedLineFeatures() throws GeometryException {
testMergesLinestrings(Map.of("admin_level", 2), Boundary.LAYER_NAME, 10, 13);
testMergesLinestrings(Map.of("admin_level", 2), Boundary.LAYER_NAME, 10, 14);
}
@Test
public void testOsmTownBoundary() {
void testOsmTownBoundary() {
var relation = new OsmElement.Relation(1);
relation.setTag("type", "boundary");
relation.setTag("admin_level", "10");
@@ -213,7 +213,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testOsmBoundaryLevelTwoAndAHalf() {
void testOsmBoundaryLevelTwoAndAHalf() {
var relation = new OsmElement.Relation(1);
relation.setTag("type", "boundary");
relation.setTag("admin_level", "2.5");
@@ -236,7 +236,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testOsmBoundaryTakesMinAdminLevel() {
void testOsmBoundaryTakesMinAdminLevel() {
var relation1 = new OsmElement.Relation(1);
relation1.setTag("type", "boundary");
relation1.setTag("admin_level", "10");
@@ -263,7 +263,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testOsmBoundarySetsMaritimeFromWay() {
void testOsmBoundarySetsMaritimeFromWay() {
var relation1 = new OsmElement.Relation(1);
relation1.setTag("type", "boundary");
relation1.setTag("admin_level", "10");
@@ -296,7 +296,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testIgnoresProtectedAreas() {
void testIgnoresProtectedAreas() {
var relation1 = new OsmElement.Relation(1);
relation1.setTag("type", "boundary");
relation1.setTag("admin_level", "10");
@@ -306,7 +306,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testIgnoresProtectedAdminLevelOver10() {
void testIgnoresProtectedAdminLevelOver10() {
var relation1 = new OsmElement.Relation(1);
relation1.setTag("type", "boundary");
relation1.setTag("admin_level", "11");
@@ -316,7 +316,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testOsmBoundaryDisputed() {
void testOsmBoundaryDisputed() {
var relation = new OsmElement.Relation(1);
relation.setTag("type", "boundary");
relation.setTag("admin_level", "5");
@@ -340,7 +340,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testOsmBoundaryDisputedFromWay() {
void testOsmBoundaryDisputedFromWay() {
var relation = new OsmElement.Relation(1);
relation.setTag("type", "boundary");
relation.setTag("admin_level", "5");
@@ -380,7 +380,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testCountryBoundaryEmittedIfNoName() {
void testCountryBoundaryEmittedIfNoName() {
var relation = new OsmElement.Relation(1);
relation.setTag("type", "boundary");
relation.setTag("admin_level", "2");
@@ -400,7 +400,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testCountryLeftRightName() {
void testCountryLeftRightName() {
var country1 = new OsmElement.Relation(1);
country1.setTag("type", "boundary");
country1.setTag("admin_level", "2");
@@ -504,7 +504,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testCountryBoundaryNotClosed() {
void testCountryBoundaryNotClosed() {
var country1 = new OsmElement.Relation(1);
country1.setTag("type", "boundary");
country1.setTag("admin_level", "2");
@@ -536,7 +536,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testNestedCountry() throws GeometryException {
void testNestedCountry() throws GeometryException {
var country1 = new OsmElement.Relation(1);
country1.setTag("type", "boundary");
country1.setTag("admin_level", "2");
@@ -574,7 +574,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testDontLabelBadPolygon() {
void testDontLabelBadPolygon() {
var country1 = new OsmElement.Relation(1);
country1.setTag("type", "boundary");
country1.setTag("admin_level", "2");
@@ -600,7 +600,7 @@ public class BoundaryTest extends AbstractLayerTest {
}
@Test
public void testIgnoreBadPolygonAndLabelGoodPart() throws GeometryException {
void testIgnoreBadPolygonAndLabelGoodPart() throws GeometryException {
var country1 = new OsmElement.Relation(1);
country1.setTag("type", "boundary");
country1.setTag("admin_level", "2");

View File

@@ -14,10 +14,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class BuildingTest extends AbstractLayerTest {
class BuildingTest extends AbstractLayerTest {
@Test
public void testBuilding() {
void testBuilding() {
assertFeatures(13, List.of(Map.of(
"colour", "<null>",
"hide_3d", "<null>",
@@ -42,7 +42,7 @@ public class BuildingTest extends AbstractLayerTest {
}
@Test
public void testIgnoreUndergroundBuilding() {
void testIgnoreUndergroundBuilding() {
assertFeatures(14, List.of(), process(polygonFeature(Map.of(
"building", "yes",
"location", "underground"
@@ -50,7 +50,7 @@ public class BuildingTest extends AbstractLayerTest {
}
@Test
public void testAirportBuildings() {
void testAirportBuildings() {
assertFeatures(13, List.of(Map.of(
"_layer", "building",
"_type", "polygon"
@@ -66,7 +66,7 @@ public class BuildingTest extends AbstractLayerTest {
}
@Test
public void testRenderHeights() {
void testRenderHeights() {
assertFeatures(13, List.of(Map.of(
"render_height", "<null>",
"render_min_height", "<null>"
@@ -103,7 +103,7 @@ public class BuildingTest extends AbstractLayerTest {
}
@Test
public void testOutlineHides3d() {
void testOutlineHides3d() {
var relation = new OsmElement.Relation(1);
relation.setTag("type", "building");
@@ -126,7 +126,7 @@ public class BuildingTest extends AbstractLayerTest {
}
@Test
public void testMergePolygonsZ13() throws GeometryException {
void testMergePolygonsZ13() throws GeometryException {
var poly1 = new VectorTile.Feature(
Building.LAYER_NAME,
1,
@@ -153,7 +153,7 @@ public class BuildingTest extends AbstractLayerTest {
}
@Test
public void testColor() {
void testColor() {
assertFeatures(14, List.of(Map.of(
"colour", "#ff0000"
)), process(polygonFeature(Map.of(

View File

@@ -4,10 +4,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class HousenumberTest extends AbstractLayerTest {
class HousenumberTest extends AbstractLayerTest {
@Test
public void testHousenumber() {
void testHousenumber() {
assertFeatures(14, List.of(Map.of(
"_layer", "housenumber",
"_type", "point",

View File

@@ -13,10 +13,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class LandcoverTest extends AbstractLayerTest {
class LandcoverTest extends AbstractLayerTest {
@Test
public void testNaturalEarthGlaciers() {
void testNaturalEarthGlaciers() {
var glacier1 = process(SimpleFeature.create(
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
Map.of(),
@@ -64,7 +64,7 @@ public class LandcoverTest extends AbstractLayerTest {
}
@Test
public void testNaturalEarthAntarcticIceShelves() {
void testNaturalEarthAntarcticIceShelves() {
var ice1 = process(SimpleFeature.create(
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
Map.of(),
@@ -98,7 +98,7 @@ public class LandcoverTest extends AbstractLayerTest {
}
@Test
public void testOsmLandcover() {
void testOsmLandcover() {
assertFeatures(13, List.of(Map.of(
"_layer", "landcover",
"subclass", "wood",
@@ -136,7 +136,7 @@ public class LandcoverTest extends AbstractLayerTest {
}
@Test
public void testMergeForestsBuNumPointsZ9to13() throws GeometryException {
void testMergeForestsBuNumPointsZ9to13() throws GeometryException {
Map<String, Object> map = Map.of("subclass", "wood");
assertMerges(List.of(map, map, map, map, map, map), List.of(
@@ -171,7 +171,7 @@ public class LandcoverTest extends AbstractLayerTest {
}
@Test
public void testMergeNonForestsBelowZ9() throws GeometryException {
void testMergeNonForestsBelowZ9() throws GeometryException {
Map<String, Object> map = Map.of("subclass", "dune");
assertMerges(List.of(map, map), List.of(

View File

@@ -9,10 +9,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class LanduseTest extends AbstractLayerTest {
class LanduseTest extends AbstractLayerTest {
@Test
public void testNaturalEarthUrbanAreas() {
void testNaturalEarthUrbanAreas() {
assertFeatures(0, List.of(Map.of(
"_layer", "landuse",
"class", "residential",
@@ -34,7 +34,7 @@ public class LanduseTest extends AbstractLayerTest {
}
@Test
public void testOsmLanduse() {
void testOsmLanduse() {
assertFeatures(13, List.of(
Map.of("_layer", "poi"),
Map.of(
@@ -59,7 +59,7 @@ public class LanduseTest extends AbstractLayerTest {
}
@Test
public void testGraveYardBecomesCemetery() {
void testGraveYardBecomesCemetery() {
assertFeatures(14, List.of(
Map.of("_layer", "poi"),
Map.of(
@@ -71,7 +71,7 @@ public class LanduseTest extends AbstractLayerTest {
}
@Test
public void testOsmLanduseLowerZoom() {
void testOsmLanduseLowerZoom() {
assertFeatures(6, List.of(Map.of(
"_layer", "landuse",
"class", "suburb",

View File

@@ -16,7 +16,7 @@ import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class MountainPeakTest extends AbstractLayerTest {
class MountainPeakTest extends AbstractLayerTest {
@BeforeEach
public void setupWikidataTranslation() {
@@ -24,7 +24,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testHappyPath() {
void testHappyPath() {
var peak = process(pointFeature(Map.of(
"natural", "peak",
"name", "test",
@@ -51,7 +51,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testLabelGrid() {
void testLabelGrid() {
var peak = process(pointFeature(Map.of(
"natural", "peak",
"ele", "100"
@@ -66,7 +66,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testVolcano() {
void testVolcano() {
assertFeatures(14, List.of(Map.of(
"class", "volcano"
)), process(pointFeature(Map.of(
@@ -76,7 +76,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testSaddle() {
void testSaddle() {
assertFeatures(14, List.of(Map.of(
"class", "saddle"
)), process(pointFeature(Map.of(
@@ -87,14 +87,14 @@ public class MountainPeakTest extends AbstractLayerTest {
@Test
public void testNoElevation() {
void testNoElevation() {
assertFeatures(14, List.of(), process(pointFeature(Map.of(
"natural", "volcano"
))));
}
@Test
public void testBogusElevation() {
void testBogusElevation() {
assertFeatures(14, List.of(), process(pointFeature(Map.of(
"natural", "volcano",
"ele", "11000"
@@ -102,7 +102,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testIgnorePeakLines() {
void testIgnorePeakLines() {
assertFeatures(14, List.of(), process(lineFeature(Map.of(
"natural", "peak",
"name", "name",
@@ -111,7 +111,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testMountainLinestring() {
void testMountainLinestring() {
assertFeatures(14, List.of(Map.of(
"class", "ridge",
"name", "Ridge",
@@ -128,7 +128,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testCustomaryFt() {
void testCustomaryFt() {
process(SimpleFeature.create(
rectangle(0, 0.1),
Map.of("iso_a2", "US"),
@@ -180,7 +180,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testSortKey() {
void testSortKey() {
assertAscending(
getSortKey(Map.of(
"natural", "peak",
@@ -201,7 +201,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testMountainPeakPostProcessing() throws GeometryException {
void testMountainPeakPostProcessing() throws GeometryException {
assertEquals(List.of(), profile.postProcessLayerFeatures(MountainPeak.LAYER_NAME, 13, List.of()));
assertEquals(List.of(pointFeature(
@@ -248,7 +248,7 @@ public class MountainPeakTest extends AbstractLayerTest {
}
@Test
public void testMountainPeakPostProcessingLimitsFeaturesOutsideZoom() throws GeometryException {
void testMountainPeakPostProcessingLimitsFeaturesOutsideZoom() throws GeometryException {
assertEquals(Lists.newArrayList(
new VectorTile.Feature(
MountainPeak.LAYER_NAME,

View File

@@ -5,10 +5,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class ParkTest extends AbstractLayerTest {
class ParkTest extends AbstractLayerTest {
@Test
public void testNationalPark() {
void testNationalPark() {
assertFeatures(13, List.of(Map.of(
"_layer", "park",
"_type", "polygon",
@@ -46,7 +46,7 @@ public class ParkTest extends AbstractLayerTest {
}
@Test
public void testSmallerPark() {
void testSmallerPark() {
double z11area = Math.pow((GeoUtils.metersToPixelAtEquator(0, Math.sqrt(70_000)) / 256d), 2) * Math.pow(2, 20 - 11);
assertFeatures(13, List.of(Map.of(
"_layer", "park",
@@ -85,7 +85,7 @@ public class ParkTest extends AbstractLayerTest {
}
@Test
public void testSortKeys() {
void testSortKeys() {
assertAscending(
getLabelSortKey(1, Map.of(
"boundary", "national_park",

View File

@@ -17,10 +17,10 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class PlaceTest extends AbstractLayerTest {
class PlaceTest extends AbstractLayerTest {
@Test
public void testContinent() {
void testContinent() {
wikidataTranslations.put(49, "es", "América del Norte y América Central");
assertFeatures(0, List.of(Map.of(
"_layer", "place",
@@ -44,7 +44,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testCountry() {
void testCountry() {
wikidataTranslations.put(30, "es", "Estados Unidos");
process(SimpleFeature.create(
rectangle(0, 0.25),
@@ -112,7 +112,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testState() {
void testState() {
wikidataTranslations.put(771, "es", "Massachusetts es");
process(SimpleFeature.create(
rectangle(0, 0.25),
@@ -195,7 +195,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testProvince() {
void testProvince() {
wikidataTranslations.put(95027, "es", "provincia de Lugo");
process(SimpleFeature.create(
rectangle(0, 0.25),
@@ -233,7 +233,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testIslandPoint() {
void testIslandPoint() {
assertFeatures(0, List.of(Map.of(
"_layer", "place",
"class", "island",
@@ -253,7 +253,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testIslandPolygon() {
void testIslandPolygon() {
assertFeatures(0, List.of(Map.of(
"_layer", "place",
"class", "island",
@@ -290,7 +290,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testPlaceSortKeyRanking() {
void testPlaceSortKeyRanking() {
int[] sortKeys = new int[]{
// max
getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name"),
@@ -324,7 +324,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testCountryCapital() {
void testCountryCapital() {
process(SimpleFeature.create(
newPoint(0, 0),
Map.of(
@@ -358,7 +358,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testStateCapital() {
void testStateCapital() {
process(SimpleFeature.create(
newPoint(0, 0),
Map.of(
@@ -434,7 +434,7 @@ public class PlaceTest extends AbstractLayerTest {
@Test
public void testCityWithoutNaturalEarthMatch() {
void testCityWithoutNaturalEarthMatch() {
assertFeatures(7, List.of(Map.of(
"_layer", "place",
"class", "city",
@@ -474,7 +474,7 @@ public class PlaceTest extends AbstractLayerTest {
}
@Test
public void testCitySetRankFromGridrank() throws GeometryException {
void testCitySetRankFromGridrank() throws GeometryException {
var layerName = Place.LAYER_NAME;
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));

View File

@@ -10,14 +10,14 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
public class PoiTest extends AbstractLayerTest {
class PoiTest extends AbstractLayerTest {
private SourceFeature feature(boolean area, Map<String, Object> tags) {
return area ? polygonFeature(tags) : pointFeature(tags);
}
@Test
public void testFenwayPark() {
void testFenwayPark() {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "stadium",
@@ -34,7 +34,7 @@ public class PoiTest extends AbstractLayerTest {
@ParameterizedTest
@ValueSource(booleans = {false, true})
public void testFunicularHalt(boolean area) {
void testFunicularHalt(boolean area) {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "railway",
@@ -50,7 +50,7 @@ public class PoiTest extends AbstractLayerTest {
@ParameterizedTest
@ValueSource(booleans = {false, true})
public void testSubway(boolean area) {
void testSubway(boolean area) {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "railway",
@@ -66,7 +66,7 @@ public class PoiTest extends AbstractLayerTest {
@ParameterizedTest
@ValueSource(booleans = {false, true})
public void testPlaceOfWorshipFromReligionTag(boolean area) {
void testPlaceOfWorshipFromReligionTag(boolean area) {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "place_of_worship",
@@ -81,7 +81,7 @@ public class PoiTest extends AbstractLayerTest {
}
@Test
public void testPitchFromSportTag() {
void testPitchFromSportTag() {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "pitch",
@@ -96,7 +96,7 @@ public class PoiTest extends AbstractLayerTest {
@ParameterizedTest
@ValueSource(booleans = {false, true})
public void testInformation(boolean area) {
void testInformation(boolean area) {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "information",
@@ -117,7 +117,7 @@ public class PoiTest extends AbstractLayerTest {
@ParameterizedTest
@ValueSource(booleans = {false, true})
public void testFerryTerminal(boolean area) {
void testFerryTerminal(boolean area) {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "ferry_terminal",
@@ -135,7 +135,7 @@ public class PoiTest extends AbstractLayerTest {
}
@Test
public void testGridRank() throws GeometryException {
void testGridRank() throws GeometryException {
var layerName = Poi.LAYER_NAME;
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
@@ -183,7 +183,7 @@ public class PoiTest extends AbstractLayerTest {
}
@Test
public void testEmbassy() {
void testEmbassy() {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "diplomatic",
@@ -196,7 +196,7 @@ public class PoiTest extends AbstractLayerTest {
}
@Test
public void testLocksmith() {
void testLocksmith() {
assertFeatures(7, List.of(Map.of(
"_layer", "poi",
"class", "shop",

View File

@@ -20,10 +20,10 @@ import java.util.Map;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
public class TransportationTest extends AbstractLayerTest {
class TransportationTest extends AbstractLayerTest {
@Test
public void testNamedFootway() {
void testNamedFootway() {
FeatureCollector result = process(lineFeature(Map.of(
"name", "Lagoon Path",
"surface", "asphalt",
@@ -78,7 +78,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testImportantPath() {
void testImportantPath() {
var rel = new OsmElement.Relation(1);
rel.setTag("colour", "white");
@@ -128,7 +128,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testUnnamedPath() {
void testUnnamedPath() {
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "path",
@@ -143,7 +143,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testPrivatePath() {
void testPrivatePath() {
assertFeatures(9, List.of(Map.of(
"_layer", "transportation",
"class", "path",
@@ -171,7 +171,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testExpressway() {
void testExpressway() {
assertFeatures(8, List.of(Map.of(
"_layer", "transportation",
"class", "motorway",
@@ -199,7 +199,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testToll() {
void testToll() {
assertFeatures(9, List.of(Map.of(
"_layer", "transportation",
"class", "motorway",
@@ -226,7 +226,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testIndoorTunnelSteps() {
void testIndoorTunnelSteps() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "path",
@@ -244,7 +244,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testInterstateMotorway() {
void testInterstateMotorway() {
var rel = new OsmElement.Relation(1);
rel.setTag("type", "route");
rel.setTag("route", "road");
@@ -340,7 +340,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testRouteWithoutNetworkType() {
void testRouteWithoutNetworkType() {
var rel1 = new OsmElement.Relation(1);
rel1.setTag("type", "route");
rel1.setTag("route", "road");
@@ -383,7 +383,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testMinorRouteRef() {
void testMinorRouteRef() {
var rel1 = new OsmElement.Relation(1);
rel1.setTag("type", "route");
rel1.setTag("route", "road");
@@ -423,7 +423,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testPolishHighwayIssue165() {
void testPolishHighwayIssue165() {
var rel1 = new OsmElement.Relation(1);
rel1.setTag("type", "route");
rel1.setTag("route", "road");
@@ -463,7 +463,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testMotorwayJunction() {
void testMotorwayJunction() {
var otherNode1 = new OsmElement.Node(1, 1, 1);
var junctionNode = new OsmElement.Node(2, 1, 2);
var otherNode2 = new OsmElement.Node(3, 1, 3);
@@ -512,7 +512,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testInterstateMotorwayWithoutWayInfo() {
void testInterstateMotorwayWithoutWayInfo() {
var rel = new OsmElement.Relation(1);
rel.setTag("type", "route");
rel.setTag("route", "road");
@@ -543,7 +543,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testPrimaryRoadConstruction() {
void testPrimaryRoadConstruction() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "primary_construction",
@@ -568,7 +568,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testBridgeConstruction() {
void testBridgeConstruction() {
assertFeatures(14, List.of(), process(lineFeature(Map.of(
"highway", "construction",
"construction", "bridge",
@@ -589,7 +589,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testIgnoreManMadeWhenNotBridgeOrPier() {
void testIgnoreManMadeWhenNotBridgeOrPier() {
// https://github.com/onthegomap/planetiler/issues/69
assertFeatures(14, List.of(), process(lineFeature(Map.of(
"man_made", "storage_tank",
@@ -607,7 +607,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testRaceway() {
void testRaceway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "raceway",
@@ -628,7 +628,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testDriveway() {
void testDriveway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "service",
@@ -641,7 +641,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testMountainBikeTrail() {
void testMountainBikeTrail() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "path",
@@ -666,7 +666,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testNamedTrack() {
void testNamedTrack() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "track",
@@ -687,7 +687,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testUnnamedTrack() {
void testUnnamedTrack() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "track",
@@ -702,7 +702,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testBusway() {
void testBusway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "busway",
@@ -743,7 +743,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testUSAndStateHighway() {
void testUSAndStateHighway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "primary",
@@ -803,7 +803,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testUsStateHighway() {
void testUsStateHighway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "primary"
@@ -827,7 +827,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testCompoundRef() {
void testCompoundRef() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "primary",
@@ -851,7 +851,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testTransCanadaHighway() {
void testTransCanadaHighway() {
var rel = new OsmElement.Relation(1);
rel.setTag("type", "route");
rel.setTag("route", "road");
@@ -887,7 +887,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testGreatBritainHighway() {
void testGreatBritainHighway() {
process(SimpleFeature.create(
rectangle(0, 0.1),
Map.of("iso_a2", "GB"),
@@ -950,17 +950,17 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testMergesDisconnectedRoadFeatures() throws GeometryException {
void testMergesDisconnectedRoadFeatures() throws GeometryException {
testMergesLinestrings(Map.of("class", "motorway"), Transportation.LAYER_NAME, 10, 14);
}
@Test
public void testMergesDisconnectedRoadNameFeatures() throws GeometryException {
void testMergesDisconnectedRoadNameFeatures() throws GeometryException {
testMergesLinestrings(Map.of("class", "motorway"), TransportationName.LAYER_NAME, 10, 14);
}
@Test
public void testLightRail() {
void testLightRail() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "transit",
@@ -982,7 +982,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testSubway() {
void testSubway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "transit",
@@ -1005,7 +1005,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testRail() {
void testRail() {
assertFeatures(8, List.of(Map.of(
"_layer", "transportation",
"class", "rail",
@@ -1047,7 +1047,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testNarrowGauge() {
void testNarrowGauge() {
assertFeatures(10, List.of(Map.of(
"_layer", "transportation",
"class", "rail",
@@ -1062,7 +1062,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testAerialway() {
void testAerialway() {
assertFeatures(12, List.of(Map.of(
"_layer", "transportation",
"class", "aerialway",
@@ -1092,7 +1092,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testFerry() {
void testFerry() {
assertFeatures(10, List.of(Map.of(
"_layer", "transportation",
"class", "ferry",
@@ -1126,7 +1126,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testPiers() {
void testPiers() {
// area
assertFeatures(10, List.of(Map.of(
"_layer", "transportation",
@@ -1151,7 +1151,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testPedestrianArea() {
void testPedestrianArea() {
Map<String, Object> pedestrianArea = Map.of(
"_layer", "transportation",
"class", "path",
@@ -1204,7 +1204,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testSortKeys() {
void testSortKeys() {
assertDescending(
getWaySortKey(Map.of("highway", "footway", "layer", "2")),
getWaySortKey(Map.of("highway", "motorway", "bridge", "yes")),
@@ -1224,7 +1224,7 @@ public class TransportationTest extends AbstractLayerTest {
}
@Test
public void testTransportationNameLayerRequiresTransportationLayer() {
void testTransportationNameLayerRequiresTransportationLayer() {
var profile = new BasemapProfile(translations, PlanetilerConfig.from(Arguments.of(
"only_layers", "transportation_name"
)), Stats.inMemory());

View File

@@ -15,10 +15,10 @@ import java.util.Map;
import org.junit.jupiter.api.Test;
import org.locationtech.jts.geom.Geometry;
public class WaterNameTest extends AbstractLayerTest {
class WaterNameTest extends AbstractLayerTest {
@Test
public void testWaterNamePoint() {
void testWaterNamePoint() {
assertFeatures(11, List.of(Map.of(
"_layer", "water"
), Map.of(
@@ -54,7 +54,7 @@ public class WaterNameTest extends AbstractLayerTest {
}
@Test
public void testWaterNameLakeline() {
void testWaterNameLakeline() {
assertFeatures(11, List.of(), process(SimpleFeature.create(
newLineString(0, 0, 1, 1),
new HashMap<>(Map.<String, Object>of(
@@ -91,7 +91,7 @@ public class WaterNameTest extends AbstractLayerTest {
}
@Test
public void testWaterNameMultipleLakelines() {
void testWaterNameMultipleLakelines() {
assertFeatures(11, List.of(), process(SimpleFeature.create(
newLineString(0, 0, 1, 1),
new HashMap<>(Map.<String, Object>of(
@@ -141,7 +141,7 @@ public class WaterNameTest extends AbstractLayerTest {
}
@Test
public void testMarinePoint() {
void testMarinePoint() {
assertFeatures(11, List.of(), process(SimpleFeature.create(
newLineString(0, 0, 1, 1),
new HashMap<>(Map.<String, Object>of(

View File

@@ -10,11 +10,11 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
public class WaterTest extends AbstractLayerTest {
class WaterTest extends AbstractLayerTest {
@Test
public void testWaterNaturalEarth() {
void testWaterNaturalEarth() {
assertFeatures(0, List.of(Map.of(
"class", "lake",
"intermittent", "<null>",
@@ -71,7 +71,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testWaterOsmWaterPolygon() {
void testWaterOsmWaterPolygon() {
assertFeatures(0, List.of(Map.of(
"class", "ocean",
"intermittent", "<null>",
@@ -89,7 +89,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testWater() {
void testWater() {
assertFeatures(14, List.of(Map.of(
"class", "lake",
"_layer", "water",
@@ -153,7 +153,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testRiverbank() {
void testRiverbank() {
assertFeatures(11, List.of(Map.of(
"class", "river",
"_layer", "water",
@@ -164,7 +164,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testRiverk() {
void testRiverk() {
assertFeatures(11, List.of(Map.of(
"class", "river",
"_layer", "water",
@@ -175,7 +175,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testSpring() {
void testSpring() {
assertFeatures(11, List.of(Map.of(
"class", "lake",
"_layer", "water",
@@ -186,7 +186,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testOceanZoomLevels() {
void testOceanZoomLevels() {
assertCoversZoomRange(0, 14, "water",
process(SimpleFeature.create(
rectangle(0, 10),
@@ -220,7 +220,7 @@ public class WaterTest extends AbstractLayerTest {
}
@Test
public void testLakeZoomLevels() {
void testLakeZoomLevels() {
assertCoversZoomRange(0, 14, "water",
process(SimpleFeature.create(
rectangle(0, 10),

View File

@@ -19,11 +19,11 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
public class WaterwayTest extends AbstractLayerTest {
class WaterwayTest extends AbstractLayerTest {
@ParameterizedTest
@ValueSource(booleans = {false, true})
public void testOsmWaterwayRelation(boolean isLongEnough) throws GeometryException {
void testOsmWaterwayRelation(boolean isLongEnough) throws GeometryException {
var rel = new OsmElement.Relation(1);
rel.setTag("name", "River Relation");
rel.setTag("name:es", "ES name");
@@ -83,7 +83,7 @@ public class WaterwayTest extends AbstractLayerTest {
}
@Test
public void testWaterwayImportantRiverProcess() {
void testWaterwayImportantRiverProcess() {
var charlesRiver = process(lineFeature(Map.of(
"waterway", "river",
"name", "charles river",
@@ -119,7 +119,7 @@ public class WaterwayTest extends AbstractLayerTest {
}
@Test
public void testWaterwayImportantRiverPostProcess() throws GeometryException {
void testWaterwayImportantRiverPostProcess() throws GeometryException {
var line1 = new VectorTile.Feature(
Waterway.LAYER_NAME,
1,
@@ -157,7 +157,7 @@ public class WaterwayTest extends AbstractLayerTest {
}
@Test
public void testWaterwaySmaller() {
void testWaterwaySmaller() {
// river with no name is not important
assertFeatures(14, List.of(Map.of(
"class", "river",
@@ -193,7 +193,7 @@ public class WaterwayTest extends AbstractLayerTest {
}
@Test
public void testWaterwayNaturalEarth() {
void testWaterwayNaturalEarth() {
assertFeatures(3, List.of(Map.of(
"class", "river",
"name", "<null>",

View File

@@ -15,14 +15,14 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
public class LanguageUtilsTest {
class LanguageUtilsTest {
private final Wikidata.WikidataTranslations wikidataTranslations = new Wikidata.WikidataTranslations();
private final Translations translations = Translations.defaultProvider(List.of("en", "es", "de"))
.addTranslationProvider(wikidataTranslations);
@Test
public void testSimpleExample() {
void testSimpleExample() {
assertSubmap(Map.of(
"name", "name",
"name_en", "english name",
@@ -68,7 +68,7 @@ public class LanguageUtilsTest {
"日本, false",
"abc本123, false",
})
public void testIsLatin(String in, boolean isLatin) {
void testIsLatin(String in, boolean isLatin) {
if (!isLatin) {
assertFalse(containsOnlyLatinCharacters(in));
} else {
@@ -89,7 +89,7 @@ public class LanguageUtilsTest {
"Japan - 日本~+ , 日本~+",
"Japan / 日本 / Japan , 日本",
}, nullValues = "null")
public void testRemoveNonLatin(String in, String out) {
void testRemoveNonLatin(String in, String out) {
assertEquals(out, LanguageUtils.getNames(Map.of(
"name", in
), translations).get("name:nonlatin"));
@@ -134,7 +134,7 @@ public class LanguageUtilsTest {
"name:gcf",
"name:gsw",
})
public void testLatinFallbacks(String key) {
void testLatinFallbacks(String key) {
assertEquals("a", LanguageUtils.getNames(Map.of(
key, "a"
), translations).get("name:latin"));
@@ -164,7 +164,7 @@ public class LanguageUtilsTest {
"name:etymology:left",
"name:genitive",
})
public void testNoLatinFallback(String key) {
void testNoLatinFallback(String key) {
assertSubmap(Map.of(
"name", "Branch HillLoveland Road",
"name_en", "Branch HillLoveland Road",
@@ -193,7 +193,7 @@ public class LanguageUtilsTest {
"Αλφαβητικός Κατάλογος, Alphabētikós Katálogos",
"биологическом, biologičeskom",
})
public void testTransliterate(String in, String out) {
void testTransliterate(String in, String out) {
assertEquals(out, LanguageUtils.getNames(Map.of(
"name", in
), translations).get("name:latin"));
@@ -204,7 +204,7 @@ public class LanguageUtilsTest {
}
@Test
public void testUseWikidata() {
void testUseWikidata() {
wikidataTranslations.put(123, "es", "es name");
assertSubmap(Map.of(
"name:es", "es name"
@@ -215,7 +215,7 @@ public class LanguageUtilsTest {
}
@Test
public void testUseOsm() {
void testUseOsm() {
assertSubmap(Map.of(
"name:es", "es name osm"
), LanguageUtils.getNames(Map.of(
@@ -226,7 +226,7 @@ public class LanguageUtilsTest {
}
@Test
public void testPreferWikidata() {
void testPreferWikidata() {
wikidataTranslations.put(123, "es", "wd es name");
assertSubmap(Map.of(
"name:es", "wd es name",
@@ -240,7 +240,7 @@ public class LanguageUtilsTest {
}
@Test
public void testDontUseTranslationsWhenNotSpecified() {
void testDontUseTranslationsWhenNotSpecified() {
var result = LanguageUtils.getNamesWithoutTranslations(Map.of(
"name", "name",
"wikidata", "Q123",
@@ -253,7 +253,7 @@ public class LanguageUtilsTest {
}
@Test
public void testIgnoreLanguages() {
void testIgnoreLanguages() {
wikidataTranslations.put(123, "ja", "ja name wd");
var result = LanguageUtils.getNamesWithoutTranslations(Map.of(
"name", "name",

View File

@@ -14,7 +14,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class VerifyMonacoTest {
class VerifyMonacoTest {
private Mbtiles mbtiles;
@@ -29,18 +29,18 @@ public class VerifyMonacoTest {
}
@Test
public void testEmptyFileInvalid() {
void testEmptyFileInvalid() {
assertInvalid(mbtiles);
}
@Test
public void testEmptyTablesInvalid() {
void testEmptyTablesInvalid() {
mbtiles.createTables().addTileIndex();
assertInvalid(mbtiles);
}
@Test
public void testStilInvalidWithOneTile() throws IOException {
void testStilInvalidWithOneTile() throws IOException {
mbtiles.createTables().addTileIndex();
mbtiles.metadata().setName("name");
try (var writer = mbtiles.newBatchedTileWriter()) {