@Test public void testForFailures() { final Processor<File, File, String> compose = makeComposedProcessorFileStringProcessor(); final Iterable<Result<File, String>> processed = compose.process(nonExistingFiles); Assert.assertEquals(Arrays.asList(processed).size(), 1); for (final Result r : processed) { Assert.assertTrue(r.isFailed(), "Failed result did not fail!"); } }
@Test public void testComposition() { final Processor<File, File, String> compose = makeComposedProcessorFileStringProcessor(); final List<Result<File, File>> testFiles = testFileContentPairs .values() .stream() .map(fileContentPair -> fileContentPair.file) .map(file -> Result.success(file, file)) .collect(Collectors.toList()); final Iterable<Result<File, String>> processed = compose.process(testFiles); for (final Result r : processed) { Assert.assertFalse(r.isFailed(), "Failed result did not fail!"); final FileContentPair fileContentPair = testFileContentPairs.get(r.getOutput()); Assert.assertNotNull(fileContentPair); } }