WarcModule extends ModuleBase { @Override public void parse(RandomAccessFile file, RepInfo info) throws IOException { try (InputStream stream = new RandomAccessFileInputStream(file)) { parse(stream, info, 0); } } WarcModule(); @Override void resetParams(); @Override void checkSignatures(File file,
            InputStream stream,
            RepInfo info); @Override void checkSignatures(File file,
            RandomAccessFile raf,
            RepInfo info); @Override void parse(RandomAccessFile file, RepInfo info); @Override int parse(InputStream stream, RepInfo info, int parseIndex);  }
@Test public void parseValidUTF8File() throws Exception { File warcFile = new File("src/test/resources/warc/valid-warcfile-utf8.warc"); assertTrue( warcFile.isFile() ); WarcModule wm = new WarcModule(); RepInfo info = new RepInfo(warcFile.getAbsolutePath()); wm.parse(new FileInputStream(warcFile), info, 0); wellFormedCheck(info, wm); assertEquals(0, info.getMessage().size()); }
@Test public void parseInvalidEmptyFile() throws Exception { File warcFile = new File("src/test/resources/warc/invalid-empty.warc"); WarcModule wm = new WarcModule(); RepInfo info = new RepInfo(warcFile.getAbsolutePath()); wm.parse(new FileInputStream(warcFile), info, 0); invalidCheck(info); assertEquals(1, info.getMessage().size()); Map<String, Integer> messages = extractMessages(info.getMessage()); assertEquals(1, messages.size()); assertEquals(1, messages.get(DiagnosisType.ERROR_EXPECTED.name()).intValue()); }