### Question:
EidasAuthnResponseIssuerValidator { public void validate(ValidatedResponse validatedResponse, Assertion validatedIdentityAssertion) { if ( !Objects.equals(validatedResponse.getIssuer().getFormat(), validatedIdentityAssertion.getIssuer().getFormat()) ) { throw EidasProfileValidationSpecification.authnResponseAssertionIssuerFormatMismatch( validatedResponse.getIssuer().getFormat(), validatedIdentityAssertion.getIssuer().getFormat() ); } if ( !Objects.equals(validatedResponse.getIssuer().getValue(), validatedIdentityAssertion.getIssuer().getValue()) ) { throw EidasProfileValidationSpecification.authnResponseAssertionIssuerValueMismatch( validatedResponse.getIssuer().getValue(), validatedIdentityAssertion.getIssuer().getValue() ); } }  void validate(ValidatedResponse validatedResponse, Assertion validatedIdentityAssertion);  }### Answer:
@Test public void validationSucceedsWhenIssuerMatches() { when(responseIssuer.getFormat()).thenReturn("issuerFormat"); when(assertionIssuer.getFormat()).thenReturn("issuerFormat"); when(responseIssuer.getValue()).thenReturn("issuerValue"); when(assertionIssuer.getValue()).thenReturn("issuerValue"); validator.validate(validatedResponse, assertion); }
@Test public void validationFailsForDifferentIssuerFormats() { exception.expect(SamlTransformationErrorException.class); exception.expectMessage("Authn Response issuer format [theResponseIssuerFormat] does not match the assertion issuer format [aDifferentAssertionIssuerFormat]"); when(responseIssuer.getFormat()).thenReturn("theResponseIssuerFormat"); when(assertionIssuer.getFormat()).thenReturn("aDifferentAssertionIssuerFormat"); validator.validate(validatedResponse, assertion); }
@Test public void validationFailsForDifferentIssuerValues() { exception.expect(SamlTransformationErrorException.class); exception.expectMessage("Authn Response issuer [theResponseIssuerValue] does not match the assertion issuer [aDifferentAssertionIssuerValue]"); when(responseIssuer.getFormat()).thenReturn("issuerFormat"); when(assertionIssuer.getFormat()).thenReturn("issuerFormat"); when(responseIssuer.getValue()).thenReturn("theResponseIssuerValue"); when(assertionIssuer.getValue()).thenReturn("aDifferentAssertionIssuerValue"); validator.validate(validatedResponse, assertion); }