use of uk.gov.ida.saml.hub.domain.HubAttributeQueryRequest in project verify-hub by alphagov.
the class HubAttributeQueryRequestToSamlAttributeQueryTransformerTest method transform_shouldContainBothMdsAndAuthnAssertionsEncrypted.
@Test
public void transform_shouldContainBothMdsAndAuthnAssertionsEncrypted() {
HubAttributeQueryRequest originalQuery = aHubAttributeQueryRequest().withEncryptedMatchingDatasetAssertion(ENCRYPTED_MDS_ASSERTION).withEncryptedAuthnAssertion(ENCRYPTED_AUTHN_ASSERTION).build();
final EncryptedAssertion value1 = new EncryptedAssertionBuilder().buildObject();
final EncryptedAssertion value2 = new EncryptedAssertionBuilder().buildObject();
when(encryptedAssertionUnmarshaller.transform(ENCRYPTED_MDS_ASSERTION)).thenReturn(value1);
when(encryptedAssertionUnmarshaller.transform(ENCRYPTED_AUTHN_ASSERTION)).thenReturn(value2);
AttributeQuery transformedQuery = transformer.apply(originalQuery);
List<XMLObject> encryptedAssertions = transformedQuery.getSubject().getSubjectConfirmations().get(0).getSubjectConfirmationData().getUnknownXMLObjects(EncryptedAssertion.DEFAULT_ELEMENT_NAME);
assertThat(encryptedAssertions.size()).isEqualTo(2);
assertThat(encryptedAssertions).contains(value1, value2);
}
Aggregations