Ignore:
Timestamp:
2020-02-16T22:29:06+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #18722 - exclude json file extension from GeoJsonImporter + add robustness

File:
1 edited

Legend:

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

    r15736 r15865  
    77import static org.junit.Assert.assertTrue;
    88
     9import java.io.ByteArrayInputStream;
    910import java.io.InputStream;
     11import java.nio.charset.StandardCharsets;
    1012import java.nio.file.Files;
    1113import java.nio.file.Paths;
     
    133135    }
    134136
     137    /**
     138     * Test reading a JSON file which is not a proper GeoJSON (type missing).
     139     * @throws IllegalDataException always
     140     */
     141    @Test(expected = IllegalDataException.class)
     142    public void testReadGeoJsonWithoutType() throws IllegalDataException {
     143        new GeoJSONReader().doParseDataSet(new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8)), null);
     144    }
     145
    135146    private static boolean areEqualNodes(final OsmPrimitive p1, final OsmPrimitive p2) {
    136147        return (p1 instanceof Node)
Note: See TracChangeset for help on using the changeset viewer.