ConllUWriter extends JCasFileWriter_ImplBase { @Override public void process(JCas aJCas) throws AnalysisEngineProcessException { try (PrintWriter out = new PrintWriter( new OutputStreamWriter(getOutputStream(aJCas, filenameSuffix), targetEncoding));) { convert(aJCas, out); } catch (Exception e) { throw new AnalysisEngineProcessException(e); } }  @Override void process(JCas aJCas); static final String PARAM_TARGET_ENCODING; static final String PARAM_FILENAME_EXTENSION; static final String PARAM_WRITE_POS; static final String PARAM_WRITE_CPOS; static final String PARAM_WRITE_MORPH; static final String PARAM_WRITE_LEMMA; static final String PARAM_WRITE_DEPENDENCY; static final String PARAM_WRITE_COVERED_TEXT; static final String PARAM_WRITE_TEXT_COMMENT; }
@Test public void thatLineBreaksDoNotBreakTheFormat() throws Exception { File target = testContext.getTestOutputFolder(); JCas jcas = JCasFactory.createText("Test\ntest."); new Sentence(jcas, 0, 10).addToIndexes(); new Token(jcas, 0, 4).addToIndexes(); new Token(jcas, 5, 9).addToIndexes(); new Token(jcas, 9, 10).addToIndexes(); DocumentMetaData dmd = DocumentMetaData.create(jcas); dmd.setDocumentId("output"); AnalysisEngine writer = createEngine(ConllUWriter.class, ConllUWriter.PARAM_TARGET_LOCATION, target); writer.process(jcas); String reference = readFileToString( new File("src/test/resources/conll/u_v2/conllu-linebreaks.conllu"), "UTF-8").trim(); String actual = readFileToString(new File(target, "output.conllu"), "UTF-8").trim(); assertThat(actual).isEqualToNormalizingNewlines(reference); }