package com.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.*; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import org.junit.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class TestAbstractLoader { public static class MyLoader extends AbstractLoader{ protected MyLoader(String aPublicId, String aDtdResourceName) throws SAXException, ParserConfigurationException { super(aPublicId, aDtdResourceName); } } @Test public void test() throws SAXException, ParserConfigurationException, FileNotFoundException, IOException{ MyLoader loader = new MyLoader("test1", "test2"); try{ loader.parseInputSource(new InputSource(new FileReader("./test.xml"))); fail(); }catch(SAXParseException spe){} try{ loader.warning(new SAXParseException("test", null)); fail(); }catch(SAXParseException spe){} try{ loader.error(new SAXParseException("test", null)); fail(); }catch(SAXParseException spe){} try{ loader.fatalError(new SAXParseException("test", null)); fail(); }catch(SAXParseException spe){} assertNull(loader.resolveEntity("test", "test2")); } }