@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"); verify (sut,times(1)).unmarshalRequest(any(InputStream.class)); }
public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse) { RequestType requestType = null; final String request = generateRequestString(recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse); final InputStream is = new ByteArrayInputStream(request.getBytes()); try { requestType = unmarshalRequest(is); } catch (final SyntaxException e) { LOGGER.debug(e.toString(), e); } return requestType; }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse) { RequestType requestType = null; final String request = generateRequestString(recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse); final InputStream is = new ByteArrayInputStream(request.getBytes()); try { requestType = unmarshalRequest(is); } catch (final SyntaxException e) { LOGGER.debug(e.toString(), e); } return requestType; } }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse) { RequestType requestType = null; final String request = generateRequestString(recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse); final InputStream is = new ByteArrayInputStream(request.getBytes()); try { requestType = unmarshalRequest(is); } catch (final SyntaxException e) { LOGGER.debug(e.toString(), e); } return requestType; }  }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse) { RequestType requestType = null; final String request = generateRequestString(recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse); final InputStream is = new ByteArrayInputStream(request.getBytes()); try { requestType = unmarshalRequest(is); } catch (final SyntaxException e) { LOGGER.debug(e.toString(), e); } return requestType; }  RequestType generateRequest(String recepientSubjectNPI,
			String intermediarySubjectNPI, String purposeOfUse); String generateRequestString(String recepientSubjectNPI,
			String intermediarySubjectNPI, String purposeOfUse); String getDate(); static void main(String[] args); }
RequestGenerator { public RequestType generateRequest(String recepientSubjectNPI, String intermediarySubjectNPI, String purposeOfUse) { RequestType requestType = null; final String request = generateRequestString(recepientSubjectNPI, intermediarySubjectNPI, purposeOfUse); final InputStream is = new ByteArrayInputStream(request.getBytes()); try { requestType = unmarshalRequest(is); } catch (final SyntaxException e) { LOGGER.debug(e.toString(), e); } return requestType; }  RequestType generateRequest(String recepientSubjectNPI,
			String intermediarySubjectNPI, String purposeOfUse); String generateRequestString(String recepientSubjectNPI,
			String intermediarySubjectNPI, String purposeOfUse); String getDate(); static void main(String[] args);  }