### Question:
IdpAuthnRequestGeneratorService { public SamlRequestDto generateSaml(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto) { URI ssoUri = idpSingleSignOnServiceHelper.getSingleSignOn(idaAuthnRequestFromHubDto.getIdpEntityId()); IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, ssoUri, hubEntityId); String request = idaRequestStringTransformer.apply(idaAuthnRequestFromHub); return new SamlRequestDto(request, ssoUri); } @Inject  IdpAuthnRequestGeneratorService(IdpSingleSignOnServiceHelper idpSingleSignOnServiceHelper,
                                           Function<IdaAuthnRequestFromHub, String> idaRequestStringTransformer,
                                           IdaAuthnRequestTranslator idaAuthnRequestTranslator,
                                           @Named("HubEntityId") String hubEntityId); SamlRequestDto generateSaml(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto);  }### Answer:
@Test public void get_sendAuthnRequest_shouldReturnDtoWithSamlRequestAndPostLocation(){ String idpEntityId = UUID.randomUUID().toString(); IdaAuthnRequestFromHubDto dto = new IdaAuthnRequestFromHubDto("1", null, Optional.of(false), null, idpEntityId, false); String samlRequest = "samlRequest"; URI ssoUri = UriBuilder.fromPath(UUID.randomUUID().toString()).build(); when(idaAuthnRequestFromHubStringTransformer.apply(ArgumentMatchers.any())).thenReturn(samlRequest); when(idpSingleSignOnServiceHelper.getSingleSignOn(idpEntityId)).thenReturn(ssoUri); when(idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(dto, ssoUri, HUB_ENTITY_ID)).thenReturn(null); final SamlRequestDto output = idpAuthnRequestGeneratorService.generateSaml(dto); assertThat(output.getSamlRequest()).isEqualTo(samlRequest); assertThat(output.getSsoUri()).isEqualTo(ssoUri); }