/** test that using an output argument produces the same output as stdout */ @Test(dataProvider = "LoggingTest") public void testStdoutEquivalence(final LoggingTestProvider cfg) throws IOException { ProcessController pc = ProcessController.getThreadLocal(); // output argument ProcessSettings ps = new ProcessSettings(cfg.getCmdLine(false).split("\\s+")); pc.execAndCheck(ps); String output_argument_md5 = md5db.calculateFileMD5(cfg.argumentOutputFile); // pipe to stdout ps = new ProcessSettings(cfg.getCmdLine(true).split("\\s+")); ps.setStdoutSettings(new OutputStreamSettings(cfg.pipedOutputFile)); pc.execAndCheck(ps); MD5DB.MD5Match result = md5db.testFileMD5( "LoggingIntegrationTest", "LoggingIntegrationTest", cfg.pipedOutputFile, output_argument_md5, false); if (result.failed) { final MD5Mismatch failure = new MD5Mismatch(result.actualMD5, result.expectedMD5, result.diffEngineOutput); Assert.fail(failure.toString()); } }
@DataProvider(name = "LoggingTest") public Object[][] makeLoggingTestProvider() throws IOException { for (Boolean explicitLogFile : Arrays.asList(true, false)) { // TODO: enable other logging levels when tests for those exist new LoggingTestProvider(Level.DEBUG, explicitLogFile); } return LoggingTestProvider.getTests(LoggingTestProvider.class); }