]> git.mxchange.org Git - jcountry-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 16 Nov 2022 13:20:10 +0000 (14:20 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 16 Nov 2022 13:20:10 +0000 (14:20 +0100)
- also test setting fields on right side (country2)
- sorted members

test/org/mxchange/jcountry/model/data/CountryDataObjectTest.java

index 35d41e2eeb33737df3ebcab0e73dad5c2e0ba28b..08c6415d51eaa4df7456ca581f206d32b9c2a827 100644 (file)
@@ -265,32 +265,6 @@ public class CountryDataObjectTest {
                Assert.fail("The required parameter must never be null and if so must cause a NPE being thrown: country=" + country); //NOI18N
        }
 
-       @Test (description = "Tests Country.countryEntryCreated getter/setter")
-       public void testCountryEntryCreated () {
-               // Empty instance
-               final Country country = new CountryData();
-               final Date date = new Date();
-
-               // Set it
-               country.setCountryEntryCreated(date);
-
-               // Should be the same!
-               Assert.assertEquals(country.getCountryEntryCreated(), date);
-       }
-
-       @Test (description = "Tests Country.countryEntryUpdated getter/setter")
-       public void testCountryEntryUpdated () {
-               // Empty instance
-               final Country country = new CountryData();
-               final Date date = new Date();
-
-               // Set it
-               country.setCountryEntryUpdated(date);
-
-               // Should be the same!
-               Assert.assertEquals(country.getCountryEntryUpdated(), date);
-       }
-
        @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
        public void testCountry1EqualsDifferentAbroadDialPrefix (final Country country1, final Country country2) {
                // First change countryAbroadDialPrefix to something else
@@ -366,4 +340,86 @@ public class CountryDataObjectTest {
                Assert.assertTrue(country.equals(country));
        }
 
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentAbroadDialPrefix (final Country country1, final Country country2) {
+               // First change countryAbroadDialPrefix to something else
+               country2.setCountryAbroadDialPrefix("++"); //NOI18N
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryAbroadDialPrefix(ABROAD_DIAL_PREFIX);
+       }
+
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentCountryCode (final Country country1, final Country country2) {
+               // Next is countryCode
+               country2.setCountryCode("XX"); //NOI18N
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryCode(COUNTRY_CODE);
+       }
+
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentCountryId (final Country country1, final Country country2) {
+               // Next is countryId
+               country2.setCountryId(1l); //NOI18N
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryId(null);
+       }
+
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentExternalDialPrefix (final Country country1, final Country country2) {
+               // Next is countryExternalDialPrefix
+               country2.setCountryExternalDialPrefix("00"); //NOI18N
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryCode(EXTERNAL_DIAL_PREFIX);
+       }
+
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentI18nKey (final Country country1, final Country country2) {
+               // Next is countryI18nKey
+               country2.setCountryI18nKey("COUNTRY_XX"); //NOI18N
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryI18nKey(COUNTRY_I18N_KEY);
+       }
+
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentIsLocalDialPrefixRequired (final Country country1, final Country country2) {
+               // Next is countryId
+               country2.setCountryIsLocalPrefixRequired(Boolean.FALSE);
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryIsLocalPrefixRequired(Boolean.TRUE);
+       }
+
+       @Test (description = "Tests if Country.equals() returns false when a field has been changed to an other value", dataProvider = "same-country-provider")
+       public void testCountry2EqualsDifferentPhoneCode (final Country country1, final Country country2) {
+               // Next is countryId
+               country2.setCountryPhoneCode(COUNTRY_PHONE_CODE0);
+               Assert.assertFalse(country1.equals(country2));
+               country2.setCountryPhoneCode(COUNTRY_PHONE_CODE1);
+       }
+
+       @Test (description = "Tests Country.countryEntryCreated getter/setter")
+       public void testCountryEntryCreated () {
+               // Empty instance
+               final Country country = new CountryData();
+               final Date date = new Date();
+
+               // Set it
+               country.setCountryEntryCreated(date);
+
+               // Should be the same!
+               Assert.assertEquals(country.getCountryEntryCreated(), date);
+       }
+
+       @Test (description = "Tests Country.countryEntryUpdated getter/setter")
+       public void testCountryEntryUpdated () {
+               // Empty instance
+               final Country country = new CountryData();
+               final Date date = new Date();
+
+               // Set it
+               country.setCountryEntryUpdated(date);
+
+               // Should be the same!
+               Assert.assertEquals(country.getCountryEntryUpdated(), date);
+       }
+
 }