SimpleJaxb implements Jaxb { public <T> void marshal(T object, OutputStream out, Charset charset) throws JAXBException { marshaller.setProperty(Marshaller.JAXB_ENCODING, charset.displayName()); marshaller.marshal(object, out); } SimpleJaxb(JAXBContext jaxbContext); void marshal(T object, OutputStream out, Charset charset); T unmarshal(Class<T> type, Type genericType, Reader reader);  }
@Test public void shouldMarshalByDelegatingToJaxbMarshallerWithGivenArgument() throws JAXBException { Object arg = new Object(); OutputStream outputStream = mock(OutputStream.class); toTest.marshal(arg, outputStream, UTF8); verify(mockMarshaller).setProperty(Marshaller.JAXB_ENCODING, UTF8.displayName()); verify(mockMarshaller).marshal(arg, outputStream); }