@Test public void testGetResponseDescriptorForStubModeShouldReturnTheResponseDescriptorWhenOperationModeIsStubAndAtFirstCall() { Whitebox.setInternalState(underTest, "dialogDescriptorForStub", null); given(dialogDescriptorFactory.createDialogDescriptorForStubMode(DIALOG_DESCRIPTOR_NAME_FOR_STUB_MODE)).willReturn(dialogDescriptor); given(responseDescriptorDtoFactory.createResponseDescriptorDTO(DEFAULT_GROUPNAME, dialogDescriptor)).willReturn(responseDescriptorDTO); given(responseDescriptorDTO.getResponseDescriptor()).willReturn(responseDescriptor); given(responseDescriptor.getAttributes()).willReturn(responseDescriptorAttributes); given(template.getResource()).willReturn(resource); given(request.getBody()).willReturn(DEFAULT_GROUPNAME); ResponseDescriptorDTO result = underTest.getResponseDescriptorForStubMode(request, OperationMode.STUB); verify(responseDescriptorDtoFactory).modifyResponseDescriptorDTOForStubMode(request, responseDescriptorDTO); Assert.assertNotNull(result); }
public ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode) { ResponseDescriptorDTO responseDescriptorDTOForStub = null; if (operationMode == OperationMode.STUB) { if (dialogDescriptorForStub == null) { dialogDescriptorForStub = dialogDescriptorFactory.createDialogDescriptorForStubMode(DIALOG_DESCRIPTOR_NAME_FOR_STUB_MODE); } responseDescriptorDTOForStub = responseDescriptorDtoFactory.createResponseDescriptorDTO(request.getBody(), dialogDescriptorForStub); responseDescriptorDtoFactory.modifyResponseDescriptorDTOForStubMode(request, responseDescriptorDTOForStub); } return responseDescriptorDTOForStub; }
StubModeEvaluator { public ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode) { ResponseDescriptorDTO responseDescriptorDTOForStub = null; if (operationMode == OperationMode.STUB) { if (dialogDescriptorForStub == null) { dialogDescriptorForStub = dialogDescriptorFactory.createDialogDescriptorForStubMode(DIALOG_DESCRIPTOR_NAME_FOR_STUB_MODE); } responseDescriptorDTOForStub = responseDescriptorDtoFactory.createResponseDescriptorDTO(request.getBody(), dialogDescriptorForStub); responseDescriptorDtoFactory.modifyResponseDescriptorDTOForStubMode(request, responseDescriptorDTOForStub); } return responseDescriptorDTOForStub; } }
StubModeEvaluator { public ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode) { ResponseDescriptorDTO responseDescriptorDTOForStub = null; if (operationMode == OperationMode.STUB) { if (dialogDescriptorForStub == null) { dialogDescriptorForStub = dialogDescriptorFactory.createDialogDescriptorForStubMode(DIALOG_DESCRIPTOR_NAME_FOR_STUB_MODE); } responseDescriptorDTOForStub = responseDescriptorDtoFactory.createResponseDescriptorDTO(request.getBody(), dialogDescriptorForStub); responseDescriptorDtoFactory.modifyResponseDescriptorDTOForStubMode(request, responseDescriptorDTOForStub); } return responseDescriptorDTOForStub; }  }
StubModeEvaluator { public ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode) { ResponseDescriptorDTO responseDescriptorDTOForStub = null; if (operationMode == OperationMode.STUB) { if (dialogDescriptorForStub == null) { dialogDescriptorForStub = dialogDescriptorFactory.createDialogDescriptorForStubMode(DIALOG_DESCRIPTOR_NAME_FOR_STUB_MODE); } responseDescriptorDTOForStub = responseDescriptorDtoFactory.createResponseDescriptorDTO(request.getBody(), dialogDescriptorForStub); responseDescriptorDtoFactory.modifyResponseDescriptorDTOForStubMode(request, responseDescriptorDTOForStub); } return responseDescriptorDTOForStub; }  ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode); }
StubModeEvaluator { public ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode) { ResponseDescriptorDTO responseDescriptorDTOForStub = null; if (operationMode == OperationMode.STUB) { if (dialogDescriptorForStub == null) { dialogDescriptorForStub = dialogDescriptorFactory.createDialogDescriptorForStubMode(DIALOG_DESCRIPTOR_NAME_FOR_STUB_MODE); } responseDescriptorDTOForStub = responseDescriptorDtoFactory.createResponseDescriptorDTO(request.getBody(), dialogDescriptorForStub); responseDescriptorDtoFactory.modifyResponseDescriptorDTOForStubMode(request, responseDescriptorDTOForStub); } return responseDescriptorDTOForStub; }  ResponseDescriptorDTO getResponseDescriptorForStubMode(final WilmaHttpRequest request, final OperationMode operationMode);  }