@Test
  public void twoCountriesWithDifferentGisFeatureShouldNotBeEqual() {
    Country country1 =
        Country.countryName("France")
            .withIsoCountryCode(franceCountryCode())
            .withContinent(europe())
            .andGisFeature(franceGisFeature())
            .withCurrency(Currency.getInstance("EUR"))
            .withFipsCountryCode(franceFipsCountryCode())
            .withAdministrativeCountryInformation(franceAdministrativeCountryInformation())
            .withGeographicCountryInformation(franceGeographicCountryInformation());

    Country country2 =
        Country.countryName("France")
            .withIsoCountryCode(franceCountryCode())
            .withContinent(europe())
            .andGisFeature(antarcticaGisFeature()) // different feature
            .withCurrency(Currency.getInstance("EUR"))
            .withFipsCountryCode(franceFipsCountryCode())
            .withAdministrativeCountryInformation(franceAdministrativeCountryInformation())
            .withGeographicCountryInformation(franceGeographicCountryInformation());

    Assert.assertFalse(country1.equals(country2));
    Assert.assertTrue(country1.hashCode() != country2.hashCode());
  }
  @Test
  public void twoCountriesWithSameGisFeatureShouldBeEqual() {
    Country country1 =
        Country.countryName("France")
            .withIsoCountryCode(franceCountryCode())
            .withContinent(europe())
            .andGisFeature(franceGisFeature())
            .withCurrency(Currency.getInstance("EUR"))
            .withFipsCountryCode(franceFipsCountryCode())
            .withAdministrativeCountryInformation(franceAdministrativeCountryInformation())
            .withGeographicCountryInformation(franceGeographicCountryInformation());

    Country country2 =
        Country.countryName("Antarctica")
            .withIsoCountryCode(antarcticaCountryCode())
            .withContinent(antarcticaContinent())
            .andGisFeature(franceGisFeature()) // france gis feature
            .withCurrency(null)
            .withFipsCountryCode(antarcticaFipsCountryCode())
            .withAdministrativeCountryInformation(antarcticaAdministrativeCountryInformation())
            .withGeographicCountryInformation(antarcticaGeographicCountryInformation());

    Assert.assertEquals(country1, country2);
    Assert.assertEquals(country1.hashCode(), country2.hashCode());
  }
 private Country createFranceWithMockGisFeatureProvider(GisFeatureProvider gisFeatureProvider) {
   return Country.countryName("France")
       .withIsoCountryCode(franceCountryCode())
       .withContinent(europe())
       .andGisFeatureProvider(gisFeatureProvider)
       .withCurrency(Currency.getInstance("EUR"))
       .withFipsCountryCode(franceFipsCountryCode())
       .withAdministrativeCountryInformation(franceAdministrativeCountryInformation())
       .withGeographicCountryInformation(franceGeographicCountryInformation());
 }
 @Test(expected = IllegalArgumentException.class)
 public void shouldNotCreateCountryWhenContinentIsNull() {
   Country.countryName("France")
       .withIsoCountryCode(franceCountryCode())
       .withContinent(null)
       .andGisFeature(franceGisFeature())
       .withCurrency(Currency.getInstance("EUR"))
       .withFipsCountryCode(franceFipsCountryCode())
       .withAdministrativeCountryInformation(franceAdministrativeCountryInformation())
       .withGeographicCountryInformation(franceGeographicCountryInformation());
 }
 private void assertFrance(Country france) {
   assertEquals("France", france.getName());
   assertEquals(franceCountryCode(), france.getIsoCountryCode());
   assertEquals(europe(), france.getContinent());
   assertEquals(franceGisFeature(), france.getGisFeature());
   assertEquals(Currency.getInstance("EUR"), france.getCurrency());
   assertEquals(franceFipsCountryCode(), france.getFipsCountryCode());
   assertEquals(
       franceAdministrativeCountryInformation(), france.getAdministrativeCountryInformation());
   assertEquals(franceGeographicCountryInformation(), france.getGeographicCountryInformation());
 }
 @Test
 public void shouldCreateFranceUsingGisFeatureProvider() {
   Country france =
       Country.countryName("France")
           .withIsoCountryCode(franceCountryCode())
           .withContinent(europe())
           .andGisFeatureProvider(new InMemoryGeonamesGisFeatureProvider(franceGisFeature()))
           .withCurrency(Currency.getInstance("EUR"))
           .withFipsCountryCode(franceFipsCountryCode())
           .withAdministrativeCountryInformation(franceAdministrativeCountryInformation())
           .withGeographicCountryInformation(franceGeographicCountryInformation());
   assertFrance(france);
 }