@Test
public void testParseExtendedData() throws ServiceException, URISyntaxException, FactoryException {

    File file = new File(getClass().getResource("user_data.kml").toURI());
    KMLParser kml = new KMLParser();
    SimpleFeatureCollection fc = kml.parse(file, null, CRS.decode("EPSG:3067"));
    SimpleFeatureType schema = fc.getSchema();
    boolean found = false;
    // test schema
    assertEquals(5, schema.getAttributeCount());
    assertEquals(Geometry.class, schema.getDescriptor(KMLParser.KML_GEOM).getType().getBinding());
    assertEquals(String.class, schema.getDescriptor("Opening hours").getType().getBinding());
    // test feature count
    assertEquals(5, fc.size());
    // loop features
    SimpleFeatureIterator it = fc.features();
    while (it.hasNext()){
        SimpleFeature feature = it.next();
        assertEquals(5, feature.getAttributeCount());
        if ("Ruskeasuo".equals(feature.getAttribute(KMLParser.KML_NAME))){
            found = true;
            Point p = (Point) feature.getDefaultGeometry();
            Coordinate c = p.getCoordinate();
            assertEquals(383726.9520816681, c.x, 1e-6);
            assertEquals(6676234.520781213, c.y, 1e-6);
            assertEquals(0.0, c.z, 0.0);
            assertEquals("Floorball arena", feature.getAttribute(KMLParser.KML_DESC));
            assertEquals("9-20", feature.getAttribute("Opening hours"));
            // should be empty string instead of null, to get feature which matches schema
            assertEquals("", feature.getAttribute("Additional info"));
        } else if ("Route".equals(feature.getAttribute(KMLParser.KML_NAME))) {
            LineString line = (LineString) feature.getDefaultGeometry();
            assertEquals(157, line.getCoordinates().length);
            assertEquals("Route from the Arena center to the Codecorner", feature.getAttribute(KMLParser.KML_DESC));
        }
    }
    assertEquals("Failed to parse feature Ruskeasuo", true, found);
}