use of org.codice.ddf.transformer.xml.streaming.Gml3ToWkt in project ddf by codice.
the class TestXmlInputTransformer method testBadGml3Converter.
@Test
public void testBadGml3Converter() throws FileNotFoundException, CatalogTransformerException, ValidationException {
inputStream = new FileInputStream("src/test/resources/metacard1.xml");
xmlInputTransformer = new XmlInputTransformer();
xmlInputTransformer.setSaxEventHandlerConfiguration(Collections.singletonList("gml-handler"));
GmlHandlerFactory factory = new GmlHandlerFactory();
Gml3ToWkt badGml3toWkt = mock(Gml3ToWkt.class);
when(badGml3toWkt.convert(anyString())).thenThrow(new ValidationExceptionImpl());
factory.setGml3ToWkt(badGml3toWkt);
xmlInputTransformer.setSaxEventHandlerFactories(Collections.singletonList((SaxEventHandlerFactory) factory));
Metacard metacard = xmlInputTransformer.transform(inputStream);
assertThat(metacard.getAttribute(Validation.VALIDATION_ERRORS).getValue(), is("geospatial-handler"));
}
Aggregations