TransformService { public void transform(final InputStream inputStream, final OutputStream outputStream, final Transformer transformer) { Objects.requireNonNull(inputStream); Objects.requireNonNull(outputStream); Objects.requireNonNull(transformer); try (ByteArrayOutputStream repairedInput = new ByteArrayOutputStream(); ByteArrayOutputStream transformedInput = new ByteArrayOutputStream()) { repair(inputStream, repairedInput); extend(repairedInput, transformedInput); TwStoriesdata stories = parse(transformedInput); for (TwStorydata twStorydata : stories.getTwStorydata()) { transformer.transform(twStorydata, outputStream); } } catch (Exception e) { throw new TwineTransformationFailedException("Could not transform input.", e); } } @Inject  TransformService(@PublishedRepairer final TwineRepairer publishedRepairer,
                            final ExtendTwineXmlTransformer extendTwineXmlTransformer,
                            final TwineArchiveParser twineArchiveParser); void transform(final InputStream inputStream,
                          final OutputStream outputStream,
                          final Transformer transformer);  }
@Test(expected = NullPointerException.class) public void transform_NullInputStream_ThrowsNullPointerException() { OutputStream outputStream = Mockito.mock(OutputStream.class); Transformer transformer = Mockito.mock(Transformer.class); service.transform(null, outputStream, transformer); }
@Test(expected = NullPointerException.class) public void transform_NullOutputStream_ThrowsNullPointerException() { InputStream inputStream = Mockito.mock(InputStream.class); Transformer transformer = Mockito.mock(Transformer.class); service.transform(inputStream, null, transformer); }
@Test(expected = NullPointerException.class) public void transform_NullTransformer_ThrowsNullPointerException() { InputStream inputStream = Mockito.mock(InputStream.class); OutputStream outputStream = Mockito.mock(OutputStream.class); service.transform(inputStream, outputStream, null); }