### Question:
OutboundResponseFromHubToSamlResponseTransformer extends IdaResponseToSamlResponseTransformer<OutboundResponseFromHub> { @Override protected void transformAssertions(OutboundResponseFromHub originalResponse, Response transformedResponse) { originalResponse .getEncryptedAssertions().stream() .map(encryptedAssertionUnmarshaller::transform) .forEach(transformedResponse.getEncryptedAssertions()::add); } OutboundResponseFromHubToSamlResponseTransformer(
            IdaStatusMarshaller<TransactionIdaStatus> statusMarshaller,
            OpenSamlXmlObjectFactory openSamlXmlObjectFactory,
            EncryptedAssertionUnmarshaller encryptedAssertionUnmarshaller);   }### Answer:
@Test public void transformAssertions_shouldTransformMatchingServiceAssertions() throws Exception { PassthroughAssertion matchingServiceAssertion = aPassthroughAssertion().buildMatchingServiceAssertion(); Response transformedResponse = aResponse().withNoDefaultAssertion().build(); EncryptedAssertion transformedMatchingDatasetAssertion = anAssertion().build(); when(encryptedAssertionUnmarshaller.transform(matchingServiceAssertion.getUnderlyingAssertionBlob())).thenReturn(transformedMatchingDatasetAssertion); String encryptedMatchingServiceAssertion = matchingServiceAssertion.getUnderlyingAssertionBlob(); transformer.transformAssertions(anAuthnResponse().withEncryptedAssertions(Collections.singletonList(encryptedMatchingServiceAssertion)).buildOutboundResponseFromHub(), transformedResponse); assertThat(transformedResponse.getEncryptedAssertions().size()).isEqualTo(1); assertThat(transformedResponse.getEncryptedAssertions().get(0)).isEqualTo(transformedMatchingDatasetAssertion); }