LineReaderXmiWriter extends XmiWriter { public static AnalysisEngineDescription getDescription(File outputDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( LineReaderXmiWriter.class, XmiWriter.PARAM_OUTPUT_DIRECTORY, outputDirectory); }  static AnalysisEngineDescription getDescription(File outputDirectory);  }
@Test public void testXmiWriter() throws Exception { File outputDir = new File(outputDirectory, "line-reader-xmi"); outputDir.mkdirs(); String languageCode = "en-us"; CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription( LineReader.class, null, LineReader.PARAM_FILE_OR_DIRECTORY_NAME, inputDir, LineReader.PARAM_LANGUAGE, languageCode, LineReader.PARAM_SUFFIXES, new String[] { ".txt", ".dat" }); AnalysisEngineDescription xmiWriter = LineReaderXmiWriter.getDescription(outputDir); SimplePipeline.runPipeline(reader, xmiWriter); List<String> actualFiles = Arrays.asList(outputDir.list()); List<String> expectedFiles1 = Arrays.asList( "a-test1.txt.1.xmi", "a-test1.txt.2.xmi", "a-test1.txt.3.xmi", "a-test1.txt.4.xmi", "a-test1.txt.5.xmi", "a-test1.txt.6.xmi", "a-test1.txt.7.xmi", "a-test1.txt.8.xmi", "b-test2.dat.9.xmi", "b-test2.dat.10.xmi", "b-test2.dat.11.xmi", "b-test2.dat.12.xmi"); List<String> expectedFiles2 = Arrays.asList( "b-test2.dat.1.xmi", "b-test2.dat.2.xmi", "b-test2.dat.3.xmi", "b-test2.dat.4.xmi", "a-test1.txt.5.xmi", "a-test1.txt.6.xmi", "a-test1.txt.7.xmi", "a-test1.txt.8.xmi", "a-test1.txt.9.xmi", "a-test1.txt.10.xmi", "a-test1.txt.11.xmi", "a-test1.txt.12.xmi"); Collections.sort(expectedFiles1); Collections.sort(expectedFiles2); Collections.sort(actualFiles); try { Assert.assertEquals(expectedFiles1, actualFiles); } catch (AssertionError e) { Assert.assertEquals(expectedFiles2, actualFiles); } }