### Question:
IdaAuthnRequestTranslator { public IdaAuthnRequestFromHub getIdaAuthnRequestFromHub(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto, URI ssoUri, String hubEntityId) { List<AuthnContext> levelsOfAssurance = idaAuthnRequestFromHubDto.getLevelsOfAssurance(); AuthnContextComparisonTypeEnumeration comparisonType; if (idaAuthnRequestFromHubDto.getUseExactComparisonType()) { comparisonType = EXACT; } else { comparisonType = MINIMUM; if (levelsOfAssurance.size() == 1) { levelsOfAssurance = Arrays.asList(levelsOfAssurance.get(0), levelsOfAssurance.get(0)); } } return createRequestToSendFromHub( idaAuthnRequestFromHubDto.getId(), levelsOfAssurance, idaAuthnRequestFromHubDto.getForceAuthentication(), idaAuthnRequestFromHubDto.getSessionExpiryTimestamp(), ssoUri, comparisonType, hubEntityId); } @Inject  IdaAuthnRequestTranslator(); IdaAuthnRequestFromHub getIdaAuthnRequestFromHub(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto, URI ssoUri, String hubEntityId);  }### Answer:
@Test public void shouldUseExactComparisonTypeAndLevelsOfAssurance(){ IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(singletonList(AuthnContext.LEVEL_2), true); IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, URI.create("http: assertThat(idaAuthnRequestFromHub.getComparisonType()).isEqualTo(AuthnContextComparisonTypeEnumeration.EXACT); assertThat(idaAuthnRequestFromHub.getLevelsOfAssurance()).containsSequence(AuthnContext.LEVEL_2); }
@Test public void shouldUseMinimumComparisonTypeAndDuplicateSingleLevelOfAssurance(){ IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(singletonList(AuthnContext.LEVEL_2), false); IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, URI.create("http: assertThat(idaAuthnRequestFromHub.getComparisonType()).isEqualTo(AuthnContextComparisonTypeEnumeration.MINIMUM); assertThat(idaAuthnRequestFromHub.getLevelsOfAssurance()).containsSequence(AuthnContext.LEVEL_2, AuthnContext.LEVEL_2); }
@Test public void shouldUseMinimumComparisonTypeAndLevelsOfAssuranceAsIs(){ IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(asList(AuthnContext.LEVEL_1, AuthnContext.LEVEL_2), false); IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, URI.create("http: assertThat(idaAuthnRequestFromHub.getComparisonType()).isEqualTo(AuthnContextComparisonTypeEnumeration.MINIMUM); assertThat(idaAuthnRequestFromHub.getLevelsOfAssurance()).containsSequence(AuthnContext.LEVEL_1, AuthnContext.LEVEL_2); }
@Test public void shouldUseMinimumComparisonTypeAndSendDuplicateLOAs(){ IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto = aRequestDto(singletonList(AuthnContext.LEVEL_2), false); IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, URI.create("http: assertThat(idaAuthnRequestFromHub.getComparisonType()).isEqualTo(AuthnContextComparisonTypeEnumeration.MINIMUM); assertThat(idaAuthnRequestFromHub.getLevelsOfAssurance()).containsSequence(AuthnContext.LEVEL_2, AuthnContext.LEVEL_2); }