@Test public void shouldDeserializeInputStreamUsingGivenJaxbWithGivenArgs() throws Exception { Class arg1 = Object.class; Type arg2 = String.class; InputStream arg3 = toInputStream("hello"); Charset arg4 = UTF8; Object expected = new Object(); ArgumentCaptor<InputStreamReader> reader = ArgumentCaptor.forClass(InputStreamReader.class); when(mockJaxb.unmarshal(eq(arg1), eq(arg2), reader.capture())).thenReturn(expected); Object actual = toTest.deserialize(arg1, arg2, arg3, arg4); InputStreamReader actualInputStream = reader.getValue(); assertEquals("UTF8", actualInputStream.getEncoding()); assertEquals("hello", IOs.toString(actualInputStream)); assertSame(expected, actual); }
public <T> T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset) throws Exception { try { return jaxb.<T>unmarshal(type, genericType, new InputStreamReader(stream, charset)); }finally{ IOs.close(stream); } }
JaxbDeserializer implements Deserializer { public <T> T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset) throws Exception { try { return jaxb.<T>unmarshal(type, genericType, new InputStreamReader(stream, charset)); }finally{ IOs.close(stream); } } }
JaxbDeserializer implements Deserializer { public <T> T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset) throws Exception { try { return jaxb.<T>unmarshal(type, genericType, new InputStreamReader(stream, charset)); }finally{ IOs.close(stream); } } JaxbDeserializer(CRestConfig crestConfig); }
JaxbDeserializer implements Deserializer { public <T> T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset) throws Exception { try { return jaxb.<T>unmarshal(type, genericType, new InputStreamReader(stream, charset)); }finally{ IOs.close(stream); } } JaxbDeserializer(CRestConfig crestConfig); T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset); }
JaxbDeserializer implements Deserializer { public <T> T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset) throws Exception { try { return jaxb.<T>unmarshal(type, genericType, new InputStreamReader(stream, charset)); }finally{ IOs.close(stream); } } JaxbDeserializer(CRestConfig crestConfig); T deserialize(Class<T> type, Type genericType, InputStream stream, Charset charset); static final String POOL_RETRIEVAL_MAX_WAIT_PROP; static final String JAXB_PROP; static final String MODEL_PACKAGE_PROP; static final String MODEL_FACTORY_CLASS_PROP; }