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 parseMetadataWrongIdTest() throws DienstencatalogusException {
        when(dienstencatalogusClientMock.retrieveMetadataFromDc(any(SamlRequest.class))).thenReturn(stubDcResponse());
        SamlRequest request = new AuthenticationRequest();
        request.setConnectionEntityId(CONNECTION_ENTITY_ID);
        request.setServiceEntityId("someNonExistingEntityId");

        dcMetadataService.resolveDcMetadata(request);

        assertNotNull(request.getConnectionEntity());
        assertNull(request.getServiceEntity());
    }