PatientCorrelationServiceSecured implements gov.hhs.fha.nhinc.nhinccomponentpatientcorrelation.PatientCorrelationSecuredPortType { @Override public AddPatientCorrelationSecuredResponseType addPatientCorrelation( AddPatientCorrelationSecuredRequestType request) { AssertionType assertion = SAML2AssertionExtractor.getInstance().extractSamlAssertion(context); return service.addPatientCorrelation(request, assertion); } PatientCorrelationServiceSecured();  PatientCorrelationServiceSecured(
        PatientCorrelationServiceFactory<RetrievePatientCorrelationsSecuredRequestType, RetrievePatientCorrelationsSecuredResponseType, AddPatientCorrelationSecuredRequestType, AddPatientCorrelationSecuredResponseType> factory); @Override RetrievePatientCorrelationsSecuredResponseType retrievePatientCorrelations(
        RetrievePatientCorrelationsSecuredRequestType request); @Override AddPatientCorrelationSecuredResponseType addPatientCorrelation(
        AddPatientCorrelationSecuredRequestType request); @Override SimplePatientCorrelationSecuredResponseType addPatientCorrelationPLQ(
        AddPatientCorrelationPLQSecuredRequestType request);  }
@Test public void addPatientCorrelation() { final AddPatientCorrelationSecuredRequestType request = new AddPatientCorrelationSecuredRequestType(); final AddPatientCorrelationSecuredResponseType expectedResponse = new AddPatientCorrelationSecuredResponseType(); context.checking(new Expectations() { { oneOf(mockFactory).createPatientCorrelationService(); will(returnValue(mockService)); oneOf(mockService).addPatientCorrelation(with(same(request)), with(aNull(AssertionType.class))); will(returnValue(expectedResponse)); } }); PatientCorrelationServiceSecured serviceUnderTest = new PatientCorrelationServiceSecured(mockFactory); AddPatientCorrelationSecuredResponseType actualResponse = serviceUnderTest.addPatientCorrelation(request); assertSame(expectedResponse, actualResponse); }