@Test public void testInvalid() throws IOException, SAXException { Generator toTest = new GeneratorFactoryImpl().createGenerator(); ContentHandler handler = mock(ContentHandler.class); doThrow(new SAXException()).when(handler).endDocument(); try (InputStream mjmlIn = this.getClass().getClassLoader().getResourceAsStream("helloworld.mjml")) { assert mjmlIn != null; assertThrows(SAXException.class, () -> { StringWriter buffer = new StringWriter(); IOUtils.copy(mjmlIn, buffer, StandardCharsets.UTF_8.name()); toTest.setContentHandler(handler); toTest.getWriter().append(buffer.getBuffer()); toTest.finished(); }); } }
@Override public Generator createGenerator() { return new MjmlGenerator(); }
GeneratorFactoryImpl implements GeneratorFactory { @Override public Generator createGenerator() { return new MjmlGenerator(); } }
GeneratorFactoryImpl implements GeneratorFactory { @Override public Generator createGenerator() { return new MjmlGenerator(); }  }
GeneratorFactoryImpl implements GeneratorFactory { @Override public Generator createGenerator() { return new MjmlGenerator(); }  @Override Generator createGenerator(); }
GeneratorFactoryImpl implements GeneratorFactory { @Override public Generator createGenerator() { return new MjmlGenerator(); }  @Override Generator createGenerator();  }