PropertyBasedMessageMarker implements MessageMarker { @Override public void markMessageHeader(final WilmaHttpRequest request) { MessageMarkerRequest messageMarkerRequest = configurationAccess.getProperties(); if (messageMarkerRequest.getNeedMessageMarker()) { request.addHeaderUpdate(WilmaHttpEntity.WILMA_LOGGER_ID, request.getWilmaMessageId()); } }  @Override void markMessageHeader(final WilmaHttpRequest request);  }
@Test public void testMarkMessageHeaderWhenRequested() { given(configurationAccess.getProperties()).willReturn(messageMarkerRequest); given(messageMarkerRequest.getNeedMessageMarker()).willReturn(true); given(request.getWilmaMessageId()).willReturn("blah"); underTest.markMessageHeader(request); verify(request).addHeaderUpdate(WilmaHttpEntity.WILMA_LOGGER_ID, "blah"); }
@Test public void testDontMarkMessageHeaderWhenNotRequested() { given(configurationAccess.getProperties()).willReturn(messageMarkerRequest); given(messageMarkerRequest.getNeedMessageMarker()).willReturn(false); given(request.getWilmaMessageId()).willReturn("blah"); underTest.markMessageHeader(request); verifyZeroInteractions(request); }