@Test public void testUnmarshalFilteringEnabled() throws IOException, JAXBException { doCallRealMethod() .when(jaxbDataFormatMock) .unmarshal(any(Exchange.class), any(InputStream.class)); when(jaxbDataFormatMock.getContext()).thenReturn(jaxbContextMock); when(jaxbContextMock.createUnmarshaller()).thenReturn(unmarshallerMock); when(jaxbDataFormatMock.needFiltering(exchangeMock)).thenReturn(true); InputStream stream = new ByteArrayInputStream(new byte[] {}); jaxbDataFormatMock.unmarshal(exchangeMock, stream); verify(unmarshallerMock).unmarshal(any(NonXmlFilterReader.class)); }