public void resolveDcMetadata(SamlRequest samlRequest) throws DienstencatalogusException {

        final DcMetadataResponse metadataFromDc = dienstencatalogusClient.retrieveMetadataFromDc(samlRequest);

        if (samlRequest instanceof AuthenticationRequest) {
            dcMetadataResponseMapper.dcMetadataToAuthenticationRequest((AuthenticationRequest) samlRequest, metadataFromDc, samlRequest.getServiceEntityId());
        } else {
            dcMetadataResponseMapper.dcMetadataToSamlRequest(samlRequest, metadataFromDc);
        }
    }
@Test
    public void resolveAuthenticationDcMetadataTest() throws DienstencatalogusException {
        when(dienstencatalogusClientMock.retrieveMetadataFromDc(any(SamlRequest.class))).thenReturn(stubDcResponse());
        SamlRequest request = new AuthenticationRequest();
        request.setConnectionEntityId(CONNECTION_ENTITY_ID);
        request.setServiceEntityId(SERVICE_ENTITY_ID);

        dcMetadataService.resolveDcMetadata(request);

        assertEquals("federation1", request.getFederationName());
        assertEquals(1, request.getLegacyWebserviceId());
        assertEquals(10, ((AuthenticationRequest) request).getMinimumRequestedAuthLevel());
        assertEquals("serviceUUID", request.getServiceUuid());
        assertEquals("permissionQuestion", request.getPermissionQuestion());
        assertEquals(true, ((AuthenticationRequest) request).getAppActive());
        assertEquals("appReturnUrl", ((AuthenticationRequest) request).getAppReturnUrl());
        assertEquals("serviceName", ((AuthenticationRequest) request).getServiceName());
        assertEquals("urn:nl-eid-gdi:1:0:entities:00000009999999999001", ((AuthenticationRequest) request).getEntityId());
        assertEquals(10, ((AuthenticationRequest) request).getMinimumRequestedAuthLevel());
        assertEquals("BSN", ((AuthenticationRequest) request).getEncryptionIdType());
        assertNotNull(request.getConnectionEntity());
        assertNotNull(request.getServiceEntity());
    }