@Test public void testGetResponseDescriptorAndRemoveShouldNotDeleteEntryWhenKeyNotFound() { Map<String, ResponseDescriptorDTO> responseDescriptorMap = new HashMap<>(); String key = "key"; responseDescriptorMap.put("someOtherKey", new ResponseDescriptorDTO(null, "", MSG_ID)); Whitebox.setInternalState(underTest, "responseDescriptorMap", responseDescriptorMap); underTest.getResponseDescriptorDTOAndRemove(key); @SuppressWarnings("unchecked") Map<String, ResponseDescriptorDTO> newDescriptorMap = (Map<String, ResponseDescriptorDTO>) Whitebox.getInternalState(underTest, "responseDescriptorMap"); assertEquals(newDescriptorMap.get("someOtherKey").getRequestBody(), MSG_ID); }
public ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key) { ResponseDescriptorDTO responseDescriptor = responseDescriptorMap.get(key); if (responseDescriptor != null) { responseDescriptorMap.remove(key); } return responseDescriptor; }
RoutingService { public ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key) { ResponseDescriptorDTO responseDescriptor = responseDescriptorMap.get(key); if (responseDescriptor != null) { responseDescriptorMap.remove(key); } return responseDescriptor; } }
RoutingService { public ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key) { ResponseDescriptorDTO responseDescriptor = responseDescriptorMap.get(key); if (responseDescriptor != null) { responseDescriptorMap.remove(key); } return responseDescriptor; }  }
RoutingService { public ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key) { ResponseDescriptorDTO responseDescriptor = responseDescriptorMap.get(key); if (responseDescriptor != null) { responseDescriptorMap.remove(key); } return responseDescriptor; }  boolean redirectRequestToStub(final WilmaHttpRequest request); ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key); void setOperationMode(final OperationMode operationMode); Map<String, StubDescriptor> getStubDescriptors(); boolean isStubModeOn(); void performModification(final StubDescriptorModificationCommand command); }
RoutingService { public ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key) { ResponseDescriptorDTO responseDescriptor = responseDescriptorMap.get(key); if (responseDescriptor != null) { responseDescriptorMap.remove(key); } return responseDescriptor; }  boolean redirectRequestToStub(final WilmaHttpRequest request); ResponseDescriptorDTO getResponseDescriptorDTOAndRemove(final String key); void setOperationMode(final OperationMode operationMode); Map<String, StubDescriptor> getStubDescriptors(); boolean isStubModeOn(); void performModification(final StubDescriptorModificationCommand command);  }