XslOutputProvider { public ByteArrayOutputStream getOutput(final XsltTransformer xsltTransformer) { Serializer serializer = serializerFactory.createSerializer(); serializer.setOutputProperty(Serializer.Property.METHOD, "xml"); serializer.setOutputProperty(Serializer.Property.INDENT, "no"); ByteArrayOutputStream output = byteArrayOutputStreamFactory.createByteArrayOutputStream(); serializer.setOutputStream(output); xsltTransformer.setDestination(serializer); return output; }  ByteArrayOutputStream getOutput(final XsltTransformer xsltTransformer);  }
@Test public void testGetOutputShouldSetDestination() { given(serializerFactory.createSerializer()).willReturn(serializer); underTest.getOutput(xsltTransformer); verify(xsltTransformer).setDestination(serializer); }
@Test public void testGetOutputShouldReturnOutput() { given(serializerFactory.createSerializer()).willReturn(serializer); given(byteArrayOutputStreamFactory.createByteArrayOutputStream()).willReturn(byteArrayOutputStream); ByteArrayOutputStream actual = underTest.getOutput(xsltTransformer); assertEquals(actual, byteArrayOutputStream); }