### Question:
CountriesService { public List<EidasCountryDto> getCountries(SessionId sessionId) { ensureTransactionSupportsEidas(sessionId); List<EidasCountryDto> eidasSupportedCountries = configProxy.getEidasSupportedCountries(); String relyingPartyId = sessionRepository.getRequestIssuerEntityId(sessionId); List<String> rpSpecificCountries = configProxy.getEidasSupportedCountriesForRP(relyingPartyId); return eidasSupportedCountries.stream() .filter(EidasCountryDto::getEnabled) .filter(country -> rpSpecificCountries.isEmpty() || rpSpecificCountries.contains(country.getEntityId())) .collect(Collectors.toList()); } @Inject  CountriesService(SessionRepository sessionRepository, TransactionsConfigProxy configProxy); List<EidasCountryDto> getCountries(SessionId sessionId); void setSelectedCountry(SessionId sessionId, String countryCode);  }### Answer:
@Test(expected = EidasNotSupportedException.class) public void shouldReturnErrorWhenGettingCountriesWithTxnNotSupportingEidas() { when(sessionRepository.getTransactionSupportsEidas(sessionId)).thenReturn(false); service.getCountries(sessionId); }
@Test public void shouldReturnEnabledSystemWideCountriesWhenRpHasNoExplicitlyEnabledCountries() { setSystemWideCountries(asList(COUNTRY_1, COUNTRY_2, DISABLED_COUNTRY)); List<EidasCountryDto> countries = service.getCountries(sessionId); assertThat(countries).isEqualTo(asList(COUNTRY_1, COUNTRY_2)); }
@Test public void shouldReturnIntersectionOfEnabledSystemWideCountriesAndRPConfiguredCountries() { setSystemWideCountries(asList(COUNTRY_1, COUNTRY_2, DISABLED_COUNTRY)); when(sessionRepository.getRequestIssuerEntityId(sessionId)).thenReturn(RELYING_PARTY_ID); when(configProxy.getEidasSupportedCountriesForRP(RELYING_PARTY_ID)).thenReturn(singletonList(COUNTRY_2.getEntityId())); assertThat(service.getCountries(sessionId)).isEqualTo(singletonList(COUNTRY_2)); }