@Test public void shouldLogAllTheRunningChildProcesses() { logger = new SubprocessLogger(stubSysMon()); String allLogs; try (LogFixture log = logFixtureFor(SubprocessLogger.class, Level.ALL)) { logger.registerAsExitHook("foo bar baz"); logger.run(); String result; synchronized (log) { result = log.getLog(); } allLogs = result; } Assertions.assertThat(allLogs).isEqualToNormalizingNewlines("WARN foo bar baz\n" + " 101 name-1 100 owner-1 0Mb 0Mb 00:00:00 command-1 \n" + " 103 name-1a 100 owner-1 0Mb 0Mb 00:00:00 command-1a \n" + "\n"); assertThat(allLogs, not(containsString("102"))); }
@Override public final synchronized void check() throws Exception { file.generate(); Assertions.assertThat(Files.exists(path)).withFailMessage("source file <%s> was not created", path).isTrue(); final String contents = new String(Files.readAllBytes(path)); Assertions.assertThat(contents).isEqualToNormalizingNewlines(this.contents); } }
@Test public void roundTrip() throws Exception { CollectionReaderDescription reader = createReaderDescription( ConllCoreNlpReader.class, ConllCoreNlpReader.PARAM_SOURCE_LOCATION, "src/test/resources/conll/corenlp", ConllCoreNlpReader.PARAM_PATTERNS, "en-orig.conll"); AnalysisEngineDescription writer = createEngineDescription( ConllCoreNlpWriter.class, ConllCoreNlpWriter.PARAM_TARGET_LOCATION, "target/test-output/ConllCoreNlpReaderWriterTest-roundTrip", ConllCoreNlpWriter.PARAM_FILENAME_SUFFIX, ".conll", ConllCoreNlpWriter.PARAM_STRIP_EXTENSION, true); runPipeline(reader, writer); String reference = FileUtils.readFileToString( new File("src/test/resources/conll/corenlp/en-ref.conll"), "UTF-8") .trim(); String actual = FileUtils.readFileToString( new File("target/test-output/ConllCoreNlpReaderWriterTest-roundTrip/en-orig.conll"), "UTF-8").trim(); assertThat(actual).isEqualToNormalizingNewlines(reference); }