### Question:
IdpResponseValidator { public void validate(Response response) { responseFromIdpValidator.validate(response); responseDestinationValidator.validate(response.getDestination()); validatedResponse = samlResponseSignatureValidator.validate(response, IDPSSODescriptor.DEFAULT_ELEMENT_NAME); List<Assertion> decryptedAssertions = assertionDecrypter.decryptAssertions(validatedResponse); validatedAssertions = samlAssertionsSignatureValidator.validate(decryptedAssertions, IDPSSODescriptor.DEFAULT_ELEMENT_NAME); responseAssertionsFromIdpValidator.validate(validatedResponse, validatedAssertions); } IdpResponseValidator(SamlResponseSignatureValidator samlResponseSignatureValidator,
                                AssertionDecrypter assertionDecrypter,
                                SamlAssertionsSignatureValidator samlAssertionsSignatureValidator,
                                EncryptedResponseFromIdpValidator<?> responseFromIdpValidator,
                                DestinationValidator responseDestinationValidator,
                                ResponseAssertionsFromIdpValidator responseAssertionsFromIdpValidator); ValidatedResponse getValidatedResponse(); ValidatedAssertions getValidatedAssertions(); void validate(Response response);  }### Answer:
@Test public void shouldValidateResponseIsEncrypted() { validator.validate(response); verify(encryptedResponseFromIdpValidator).validate(response); }
@Test public void shouldValidateResponseDestination() { validator.validate(response); verify(responseDestinationValidator).validate(response.getDestination()); }
@Test public void shouldValidateSamlResponseSignature() { validator.validate(response); verify(samlResponseSignatureValidator).validate(response, IDPSSODescriptor.DEFAULT_ELEMENT_NAME); }
@Test public void shouldValidateSamlAssertionSignature() { Assertion assertion = mock(Assertion.class); List<Assertion> assertions = List.of(assertion); ValidatedResponse validatedResponse = mock(ValidatedResponse.class); when(samlResponseSignatureValidator.validate(response, IDPSSODescriptor.DEFAULT_ELEMENT_NAME)).thenReturn(validatedResponse); when(assertionDecrypter.decryptAssertions(validatedResponse)).thenReturn(assertions); validator.validate(response); verify(samlAssertionsSignatureValidator).validate(assertions, IDPSSODescriptor.DEFAULT_ELEMENT_NAME); }