Ignore:
Timestamp:
2020-11-25T10:26:24+01:00 (3 years ago)
Author:
simon04
Message:

see #20152 - GeoJSONReader: better exception for illegal FeatureCollection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java

    r17275 r17356  
    216216    }
    217217
     218    /**
     219     * Tests error reporting for an invalid FeatureCollection
     220     * @throws Exception in case of error
     221     */
     222    @Test
     223    void testInvalidFeatureCollection() throws Exception {
     224        String featureCollection = "{\"type\": \"FeatureCollection\", \"features\": {}}";
     225        try (InputStream in = new ByteArrayInputStream(featureCollection.getBytes(StandardCharsets.UTF_8))) {
     226            IllegalArgumentException exception = assertThrows(IllegalArgumentException.class,
     227                    () -> new GeoJSONReader().doParseDataSet(in, null));
     228            assertEquals("features must be ARRAY, but is OBJECT", exception.getMessage());
     229        }
     230    }
     231
    218232}
Note: See TracChangeset for help on using the changeset viewer.