@Test public void testGenerateRequest() throws SyntaxException{ RequestGenerator sut=spy(requestGenerator); RequestType request=mock(RequestType.class); doReturn(request).when(sut).unmarshalRequest(any(InputStream.class)); when(sut.getDate()).thenReturn("2013-12-23T14:48:07-0500"); sut.generateRequest("123", "456", "TREAT", "789"); verify (sut,times(1)).unmarshalRequest(any(InputStream.class)); }
public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId){ RequestType requestType=null; String request=generateRequestString (recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse, patientId); InputStream is =new ByteArrayInputStream(request.getBytes()); try { requestType=unmarshalRequest(is); } catch (SyntaxException e) { LOGGER.debug(e.toString(),e); } return requestType; }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId){ RequestType requestType=null; String request=generateRequestString (recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse, patientId); InputStream is =new ByteArrayInputStream(request.getBytes()); try { requestType=unmarshalRequest(is); } catch (SyntaxException e) { LOGGER.debug(e.toString(),e); } return requestType; } }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId){ RequestType requestType=null; String request=generateRequestString (recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse, patientId); InputStream is =new ByteArrayInputStream(request.getBytes()); try { requestType=unmarshalRequest(is); } catch (SyntaxException e) { LOGGER.debug(e.toString(),e); } return requestType; }  }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId){ RequestType requestType=null; String request=generateRequestString (recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse, patientId); InputStream is =new ByteArrayInputStream(request.getBytes()); try { requestType=unmarshalRequest(is); } catch (SyntaxException e) { LOGGER.debug(e.toString(),e); } return requestType; }  RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId); String generateRequestString(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId); String getDate(); }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId){ RequestType requestType=null; String request=generateRequestString (recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse, patientId); InputStream is =new ByteArrayInputStream(request.getBytes()); try { requestType=unmarshalRequest(is); } catch (SyntaxException e) { LOGGER.debug(e.toString(),e); } return requestType; }  RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId); String generateRequestString(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse, String patientId); String getDate();  }