Search in sources :

Example 1 with CountryCache

use of com.helger.commons.locale.country.CountryCache in project ph-masterdata by phax.

the class VehicleSignsTest method testGetSingleCountryFromVehicleSign.

@Test
public void testGetSingleCountryFromVehicleSign() {
    final CountryCache aCC = CountryCache.getInstance();
    assertEquals(aCC.getCountry("AT"), VehicleSigns.getSingleCountryFromVehicleSign("A"));
    assertNull(VehicleSigns.getSingleCountryFromVehicleSign("XYZ"));
    try {
        // Has 2 countries
        VehicleSigns.getSingleCountryFromVehicleSign("ROK");
        fail();
    } catch (final IllegalArgumentException ex) {
    // expected
    }
}
Also used : CountryCache(com.helger.commons.locale.country.CountryCache) Test(org.junit.Test)

Example 2 with CountryCache

use of com.helger.commons.locale.country.CountryCache in project ph-masterdata by phax.

the class VehicleSignsTest method testGetAllCountriesFromVehicleSign.

@Test
public void testGetAllCountriesFromVehicleSign() {
    final CountryCache aCC = CountryCache.getInstance();
    assertEquals(new CommonsLinkedHashSet<>(aCC.getCountry("AT")), VehicleSigns.getAllCountriesFromVehicleSign("A"));
    assertEquals(new CommonsLinkedHashSet<>(), VehicleSigns.getAllCountriesFromVehicleSign("XYZ"));
    // Has 2 countries
    assertEquals(new CommonsLinkedHashSet<>(aCC.getCountry("KP"), aCC.getCountry("KR")), VehicleSigns.getAllCountriesFromVehicleSign("ROK"));
}
Also used : CountryCache(com.helger.commons.locale.country.CountryCache) Test(org.junit.Test)

Aggregations

CountryCache (com.helger.commons.locale.country.CountryCache)2 Test (org.junit.Test)2