MessageExtractor { public void extract(final WilmaHttpEntity message) { String body = message.getBody(); try { base64DecoderProcessor.process(message); fastInfosetDecompressorProcessor.process(message); } catch (SystemException | ApplicationException e) { String loggerID = message.getWilmaMessageLoggerId(); LOGGER.info("Failed to extract message content! ID: " + loggerID + ". Restoring original content...", e); message.setBody(body); } finally { closeStream(message); } }  void extract(final WilmaHttpEntity message);  }
@Test public void testExtractShouldExtractContent() throws Exception { underTest.extract(message); verify(base64DecoderProcessor).process(message); verify(fastInfosetDecompressorProcessor).process(message); }
@Test public void testExtractShouldDoNothingWhenExceptionIsThrown() throws Exception { doThrow(new ApplicationException("")).when(base64DecoderProcessor).process(message); underTest.extract(message); }