]> git.mxchange.org Git - jcontacts-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 12 Nov 2022 21:09:09 +0000 (22:09 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 12 Nov 2022 21:09:09 +0000 (22:09 +0100)
- sorted members

test/org/mxchange/jcontacts/model/contact/UserContactObjectTest.java

index adf4fcb5b29a837e89a4314ca545673efdd3d247..56f4baa0fd3e40a4e60e2feb1cb13da35dc2f0cc 100644 (file)
@@ -268,191 +268,304 @@ public class UserContactObjectTest {
                Assert.fail("Providing street with an empty string should cause an IAE to be thrown: contact=" + contact); //NOI18N
        }
 
-       @Test (description = "Tests on an expected exception if contactCountry's id is invalid", expectedExceptions = IllegalArgumentException.class)
-       public void testInvalidContactCountryId () {
-               // Init country instance with no primary key set
-               final Country country = ContactTestData.CONTACT_COUNTRY1;
+       @Test (description = "Tests entryCreated getter/setter")
+       public void testEntryCreated () {
+               // Create valid Contact instance
+               final Contact contact = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
 
-               // Set invalid countryId
-               country.setCountryId(-1l);
+               // Set entryCreated
+               contact.setContactEntryCreated(new Date());
 
-               // Should cause an NPE
+               // Should always be true
+               Assert.assertTrue(contact.getContactEntryCreated() instanceof Date);
+       }
+
+       @Test (description = "Tests entryUpdated getter/setter")
+       public void testEntryUpdated () {
+               // Create valid Contact instance
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
-                                         country,
+                                         ContactTestData.CONTACT_COUNTRY1,
                                          Boolean.FALSE
                          );
 
-               // Should never be reached
-               Assert.fail("Providing countryId with an invalid value for primary keys should cause an IAE to be thrown: contact=" + contact); //NOI18N
+               // Set entryCreated
+               contact.setContactEntryUpdated(new Date());
+
+               // Should always be true
+               Assert.assertTrue(contact.getContactEntryUpdated() instanceof Date);
        }
 
-       @Test (description = "Tests on an expected exception if houseNumber is invalid", expectedExceptions = IllegalArgumentException.class)
-       public void testInvalidContactHouseNumber () {
-               // Should cause an NPE
-               final Contact contact = new UserContact(
+       @Test (description = "Tests Contact.equals() with different primary keys")
+       public void testEqualsDifferentContactId () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE,
-                                         ContactTestData.CONTACT_STREET_NAME1,
-                                         Short.parseShort("-1"), //NOI18N
-                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         ContactTestData.CONTACT_ZIP_CODE1,
-                                         ContactTestData.CONTACT_CITY1,
-                                         ContactTestData.CONTACT_EMAIL1,
-                                         ContactTestData.CONTACT_TITLE1,
-                                         new Date(),
-                                         ContactTestData.CONTACT_COMMENT1
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
                          );
 
-               // Should never be reached
-               Assert.fail("Providing houseNumber with an invalid value should cause an IAE to be thrown: contact=" + contact); //NOI18N
+               // Set dummy fax number instance
+               contact1.setContactId(1l);
+               contact2.setContactId(2l);
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
        }
 
-       @Test (description = "Tests on an expected exception if zipCode is invalid", expectedExceptions = IllegalArgumentException.class)
-       public void testInvalidContactZipCode () {
-               // Should cause an NPE
-               final Contact contact = new UserContact(
+       @Test (description = "Tests Contact.equals() with different fax number instances")
+       public void testEqualsDifferentFaxNumber () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE,
-                                         ContactTestData.CONTACT_STREET_NAME1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         0,
-                                         ContactTestData.CONTACT_CITY1,
-                                         ContactTestData.CONTACT_EMAIL1,
-                                         ContactTestData.CONTACT_TITLE1,
-                                         new Date(),
-                                         ContactTestData.CONTACT_COMMENT1
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
                          );
 
-               // Should never be reached
-               Assert.fail("Providing zipCode with an invalid value should cause an IAE to be thrown: contact=" + contact); //NOI18N
+               // Set dummy fax number instance
+               contact1.setContactFaxNumber(new FaxNumber());
+               contact1.getContactFaxNumber().setPhoneId(1l);
+               contact2.setContactFaxNumber(new FaxNumber());
+               contact2.getContactFaxNumber().setPhoneId(2l);
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
        }
 
-       @Test (description = "Tests if an instance is created if academicTitle is null")
-       public void testNullContactAcademicTitle () {
-               // Should not fail
-               final Contact contact = new UserContact(
+       @Test (description = "Tests Contact.equals() with different landLine number instances")
+       public void testEqualsDifferentLandLineNumber () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE,
-                                         ContactTestData.CONTACT_STREET_NAME1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         ContactTestData.CONTACT_ZIP_CODE1,
-                                         ContactTestData.CONTACT_CITY1,
-                                         ContactTestData.CONTACT_EMAIL1,
-                                         null,
-                                         new Date(),
-                                         ContactTestData.CONTACT_COMMENT1
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
                          );
 
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
+               // Set dummy landLine number instance
+               contact1.setContactLandLineNumber(new LandLineNumber());
+               contact1.getContactLandLineNumber().setPhoneId(1l);
+               contact2.setContactLandLineNumber(new LandLineNumber());
+               contact2.getContactLandLineNumber().setPhoneId(2l);
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
        }
 
-       @Test (description = "Tests if an instance is created if birthday is null")
-       public void testNullContactBirthday () {
-               // Should not fail
-               final Contact contact = new UserContact(
+       @Test (description = "Tests Contact.equals() with different mobile number instances")
+       public void testEqualsDifferentMobileNumber () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE,
-                                         ContactTestData.CONTACT_STREET_NAME1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         ContactTestData.CONTACT_ZIP_CODE1,
-                                         ContactTestData.CONTACT_CITY1,
-                                         ContactTestData.CONTACT_EMAIL1,
-                                         ContactTestData.CONTACT_TITLE1,
-                                         null,
-                                         ContactTestData.CONTACT_COMMENT1
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
                          );
 
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
+               // Set dummy mobile number instance
+               contact1.setContactMobileNumber(new MobileNumber());
+               contact1.getContactMobileNumber().setMobileId(1l);
+               contact2.setContactMobileNumber(new MobileNumber());
+               contact2.getContactMobileNumber().setMobileId(2l);
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
        }
 
-       @Test (description = "Tests if an instance is created if city is null")
-       public void testNullContactCityName () {
-               // Should not fail
+       @Test (description = "Tests Contact.equals() with null reference")
+       public void testEqualsNull () {
+               // Create valid Contact instance
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE,
-                                         ContactTestData.CONTACT_STREET_NAME1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         ContactTestData.CONTACT_ZIP_CODE1,
-                                         null,
-                                         ContactTestData.CONTACT_EMAIL1,
-                                         ContactTestData.CONTACT_TITLE1,
-                                         new Date(),
-                                         ContactTestData.CONTACT_COMMENT1
+                                         Boolean.FALSE
                          );
 
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
+               // Should always be false
+               Assert.assertFalse(contact.equals(null));
        }
 
-       @Test (description = "Tests if an instance is created if comment is null")
-       public void testNullContactComment () {
-               // Should not fail
+       @Test (description = "Tests Contact.equals() with null and set primary key")
+       public void testEqualsNullContactId () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+
+               // Set dummy fax number instance
+               contact2.setContactId(-1l);
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
+       }
+
+       @Test (description = "Tests Contact.equals() with null and set fax number instance")
+       public void testEqualsNullFaxNumber () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+
+               // Set dummy fax number instance
+               contact2.setContactFaxNumber(new FaxNumber());
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
+       }
+
+       @Test (description = "Tests Contact.equals() with null and set landLine number instance")
+       public void testEqualsNullLandLineNumber () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+
+               // Set dummy landLine number instance
+               contact2.setContactLandLineNumber(new LandLineNumber());
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
+       }
+
+       @Test (description = "Tests Contact.equals() with null and set mobile number instance")
+       public void testEqualsNullMobileNumber () {
+               // Create valid Contact instances
+               final Contact contact1 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+               final Contact contact2 = new UserContact(
+                                         PersonalTitle.MR,
+                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
+                         );
+
+               // Set dummy mobile number instance
+               contact2.setContactMobileNumber(new MobileNumber());
+
+               // Should always be false
+               Assert.assertFalse(contact1.equals(contact2));
+       }
+
+       @Test (description = "Tests Contact.equals() with other instance")
+       public void testEqualsOtherInstance () {
+               // Create valid Contact instance
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE,
-                                         ContactTestData.CONTACT_STREET_NAME1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         ContactTestData.CONTACT_ZIP_CODE1,
-                                         ContactTestData.CONTACT_CITY1,
-                                         ContactTestData.CONTACT_EMAIL1,
-                                         ContactTestData.CONTACT_TITLE1,
-                                         new Date(),
-                                         null
+                                         Boolean.FALSE
                          );
 
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
+               // Should always be false
+               Assert.assertFalse(contact.equals(this));
        }
 
-       @Test (description = "Tests on an expected exception if contactCountry is null", expectedExceptions = NullPointerException.class)
-       public void testNullContactCountry () {
-               // Should throw an NPE
+       @Test (description = "Tests Contact.equals() with same instance")
+       public void testEqualsSameInstance () {
+               // Create valid Contact instance
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
-                                         null,
-                                         Boolean.TRUE
+                                         ContactTestData.CONTACT_COUNTRY1,
+                                         Boolean.FALSE
                          );
 
-               // Should never be reached
-               Assert.fail("Providing contactCountry with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
+               // Should always be true
+               Assert.assertTrue(contact.equals(contact));
        }
 
-       @Test (description = "Tests on an expected exception if contactCountry's id is null", expectedExceptions = NullPointerException.class)
-       public void testNullContactCountryId () {
-               // Get country instance and set id to null
+       @Test (description = "Tests on an expected exception if contactCountry's id is invalid", expectedExceptions = IllegalArgumentException.class)
+       public void testInvalidContactCountryId () {
+               // Init country instance with no primary key set
                final Country country = ContactTestData.CONTACT_COUNTRY1;
-               country.setCountryId(null);
+
+               // Set invalid countryId
+               country.setCountryId(-1l);
 
                // Should cause an NPE
                final Contact contact = new UserContact(
@@ -464,12 +577,12 @@ public class UserContactObjectTest {
                          );
 
                // Should never be reached
-               Assert.fail("Providing countryId with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
+               Assert.fail("Providing countryId with an invalid value for primary keys should cause an IAE to be thrown: contact=" + contact); //NOI18N
        }
 
-       @Test (description = "Tests if an instance is created if emailAddress is null")
-       public void testNullContactEmailAddress () {
-               // Should not fail
+       @Test (description = "Tests on an expected exception if houseNumber is invalid", expectedExceptions = IllegalArgumentException.class)
+       public void testInvalidContactHouseNumber () {
+               // Should cause an NPE
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
@@ -477,38 +590,23 @@ public class UserContactObjectTest {
                                          ContactTestData.CONTACT_COUNTRY1,
                                          Boolean.FALSE,
                                          ContactTestData.CONTACT_STREET_NAME1,
-                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
+                                         Short.parseShort("-1"), //NOI18N
                                          ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
                                          ContactTestData.CONTACT_ZIP_CODE1,
                                          ContactTestData.CONTACT_CITY1,
-                                         null,
+                                         ContactTestData.CONTACT_EMAIL1,
                                          ContactTestData.CONTACT_TITLE1,
                                          new Date(),
                                          ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
-       }
-
-       @Test (description = "Tests on an expected exception if contactFirstName is null", expectedExceptions = NullPointerException.class)
-       public void testNullContactFirstName () {
-               // Should throw an NPE
-               final Contact contact = new UserContact(
-                                         PersonalTitle.MR,
-                                         null,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.TRUE
-                         );
-
                // Should never be reached
-               Assert.fail("Providing contactFirstName with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
+               Assert.fail("Providing houseNumber with an invalid value should cause an IAE to be thrown: contact=" + contact); //NOI18N
        }
 
-       @Test (description = "Tests if an instance is created if houseNumber is null")
-       public void testNullContactHouseNumber () {
-               // Should not fail
+       @Test (description = "Tests on an expected exception if zipCode is invalid", expectedExceptions = IllegalArgumentException.class)
+       public void testInvalidContactZipCode () {
+               // Should cause an NPE
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
@@ -516,9 +614,9 @@ public class UserContactObjectTest {
                                          ContactTestData.CONTACT_COUNTRY1,
                                          Boolean.FALSE,
                                          ContactTestData.CONTACT_STREET_NAME1,
-                                         null,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
                                          ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
-                                         ContactTestData.CONTACT_ZIP_CODE1,
+                                         0,
                                          ContactTestData.CONTACT_CITY1,
                                          ContactTestData.CONTACT_EMAIL1,
                                          ContactTestData.CONTACT_TITLE1,
@@ -526,12 +624,12 @@ public class UserContactObjectTest {
                                          ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
+               // Should never be reached
+               Assert.fail("Providing zipCode with an invalid value should cause an IAE to be thrown: contact=" + contact); //NOI18N
        }
 
-       @Test (description = "Tests if an instance is created if houseNumberExtension is null")
-       public void testNullContactHouseNumberExtension () {
+       @Test (description = "Tests if an instance is created if academicTitle is null")
+       public void testNullContactAcademicTitle () {
                // Should not fail
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
@@ -541,11 +639,11 @@ public class UserContactObjectTest {
                                          Boolean.FALSE,
                                          ContactTestData.CONTACT_STREET_NAME1,
                                          ContactTestData.CONTACT_HOUSE_NUMBER1,
-                                         null,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
                                          ContactTestData.CONTACT_ZIP_CODE1,
                                          ContactTestData.CONTACT_CITY1,
                                          ContactTestData.CONTACT_EMAIL1,
-                                         ContactTestData.CONTACT_TITLE1,
+                                         null,
                                          new Date(),
                                          ContactTestData.CONTACT_COMMENT1
                          );
@@ -554,38 +652,8 @@ public class UserContactObjectTest {
                Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests on an expected exception if contactLastName is null", expectedExceptions = NullPointerException.class)
-       public void testNullContactLastName () {
-               // Should throw an NPE
-               final Contact contact = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         null,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.TRUE
-                         );
-
-               // Should never be reached
-               Assert.fail("Providing contactLastName with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
-       }
-
-       @Test (description = "Tests on an expected exception if contactPersonalTitle is null", expectedExceptions = NullPointerException.class)
-       public void testNullContactPersonalTitle () {
-               // Should throw an NPE
-               final Contact contact = new UserContact(
-                                         null,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.TRUE
-                         );
-
-               // Should never be reached
-               Assert.fail("Providing contactPersonalTitle with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
-       }
-
-       @Test (description = "Tests if an instance is created if street name is null")
-       public void testNullContactStreetName () {
+       @Test (description = "Tests if an instance is created if birthday is null")
+       public void testNullContactBirthday () {
                // Should not fail
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
@@ -593,14 +661,14 @@ public class UserContactObjectTest {
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
                                          Boolean.FALSE,
-                                         null,
+                                         ContactTestData.CONTACT_STREET_NAME1,
                                          ContactTestData.CONTACT_HOUSE_NUMBER1,
                                          ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
                                          ContactTestData.CONTACT_ZIP_CODE1,
                                          ContactTestData.CONTACT_CITY1,
                                          ContactTestData.CONTACT_EMAIL1,
                                          ContactTestData.CONTACT_TITLE1,
-                                         new Date(),
+                                         null,
                                          ContactTestData.CONTACT_COMMENT1
                          );
 
@@ -608,8 +676,8 @@ public class UserContactObjectTest {
                Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests if an instance is created if zipCode is null")
-       public void testNullContactZipCode () {
+       @Test (description = "Tests if an instance is created if city is null")
+       public void testNullContactCityName () {
                // Should not fail
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
@@ -620,322 +688,254 @@ public class UserContactObjectTest {
                                          ContactTestData.CONTACT_STREET_NAME1,
                                          ContactTestData.CONTACT_HOUSE_NUMBER1,
                                          ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
+                                         ContactTestData.CONTACT_ZIP_CODE1,
                                          null,
-                                         ContactTestData.CONTACT_CITY1,
                                          ContactTestData.CONTACT_EMAIL1,
                                          ContactTestData.CONTACT_TITLE1,
                                          new Date(),
-                                         ContactTestData.CONTACT_COMMENT1
-                         );
-
-               // Should pass
-               Assert.assertTrue(contact instanceof Contact);
-       }
-
-       @Test (description = "Tests on an expected exception if isOwnContact is null", expectedExceptions = NullPointerException.class)
-       public void testNullIsOwnContact () {
-               // Should throw an NPE
-               final Contact contact = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         null
-                         );
-
-               // Should never be reached
-               Assert.fail("Providing isOwnContact with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
-       }
-
-       @Test (description = "Tests Contact.equals() with same instance")
-       public void testEqualsSameInstance () {
-               // Create valid Contact instance
-               final Contact contact = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-
-               // Should always be true
-               Assert.assertTrue(contact.equals(contact));
-       }
-
-       @Test (description = "Tests Contact.equals() with null reference")
-       public void testEqualsNull () {
-               // Create valid Contact instance
-               final Contact contact = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-
-               // Should always be false
-               Assert.assertFalse(contact.equals(null));
-       }
-
-       @Test (description = "Tests Contact.equals() with other instance")
-       public void testEqualsOtherInstance () {
-               // Create valid Contact instance
-               final Contact contact = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-
-               // Should always be false
-               Assert.assertFalse(contact.equals(this));
-       }
-
-       @Test (description = "Tests Contact.equals() with null and set fax number instance")
-       public void testEqualsNullFaxNumber () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-               final Contact contact2 = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-
-               // Set dummy fax number instance
-               contact2.setContactFaxNumber(new FaxNumber());
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
-       }
-
-       @Test (description = "Tests Contact.equals() with different fax number instances")
-       public void testEqualsDifferentFaxNumber () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-               final Contact contact2 = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-
-               // Set dummy fax number instance
-               contact1.setContactFaxNumber(new FaxNumber());
-               contact1.getContactFaxNumber().setPhoneId(1l);
-               contact2.setContactFaxNumber(new FaxNumber());
-               contact2.getContactFaxNumber().setPhoneId(2l);
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
-       }
-
-       @Test (description = "Tests Contact.equals() with null and set landLine number instance")
-       public void testEqualsNullLandLineNumber () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
-                         );
-               final Contact contact2 = new UserContact(
-                                         PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Set dummy landLine number instance
-               contact2.setContactLandLineNumber(new LandLineNumber());
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests Contact.equals() with different landLine number instances")
-       public void testEqualsDifferentLandLineNumber () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
+       @Test (description = "Tests if an instance is created if comment is null")
+       public void testNullContactComment () {
+               // Should not fail
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.FALSE,
+                                         ContactTestData.CONTACT_STREET_NAME1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
+                                         ContactTestData.CONTACT_ZIP_CODE1,
+                                         ContactTestData.CONTACT_CITY1,
+                                         ContactTestData.CONTACT_EMAIL1,
+                                         ContactTestData.CONTACT_TITLE1,
+                                         new Date(),
+                                         null
                          );
-               final Contact contact2 = new UserContact(
+
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
+       }
+
+       @Test (description = "Tests on an expected exception if contactCountry is null", expectedExceptions = NullPointerException.class)
+       public void testNullContactCountry () {
+               // Should throw an NPE
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         null,
+                                         Boolean.TRUE
                          );
 
-               // Set dummy landLine number instance
-               contact1.setContactLandLineNumber(new LandLineNumber());
-               contact1.getContactLandLineNumber().setPhoneId(1l);
-               contact2.setContactLandLineNumber(new LandLineNumber());
-               contact2.getContactLandLineNumber().setPhoneId(2l);
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
+               // Should never be reached
+               Assert.fail("Providing contactCountry with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
        }
 
-       @Test (description = "Tests Contact.equals() with null and set mobile number instance")
-       public void testEqualsNullMobileNumber () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
+       @Test (description = "Tests on an expected exception if contactCountry's id is null", expectedExceptions = NullPointerException.class)
+       public void testNullContactCountryId () {
+               // Get country instance and set id to null
+               final Country country = ContactTestData.CONTACT_COUNTRY1;
+               country.setCountryId(null);
+
+               // Should cause an NPE
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
-                                         ContactTestData.CONTACT_COUNTRY1,
+                                         country,
                                          Boolean.FALSE
                          );
-               final Contact contact2 = new UserContact(
+
+               // Should never be reached
+               Assert.fail("Providing countryId with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
+       }
+
+       @Test (description = "Tests if an instance is created if emailAddress is null")
+       public void testNullContactEmailAddress () {
+               // Should not fail
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.FALSE,
+                                         ContactTestData.CONTACT_STREET_NAME1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
+                                         ContactTestData.CONTACT_ZIP_CODE1,
+                                         ContactTestData.CONTACT_CITY1,
+                                         null,
+                                         ContactTestData.CONTACT_TITLE1,
+                                         new Date(),
+                                         ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Set dummy mobile number instance
-               contact2.setContactMobileNumber(new MobileNumber());
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests Contact.equals() with different mobile number instances")
-       public void testEqualsDifferentMobileNumber () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
+       @Test (description = "Tests on an expected exception if contactFirstName is null", expectedExceptions = NullPointerException.class)
+       public void testNullContactFirstName () {
+               // Should throw an NPE
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
-                                         ContactTestData.CONTACT_FIRST_NAME1,
+                                         null,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.TRUE
                          );
-               final Contact contact2 = new UserContact(
+
+               // Should never be reached
+               Assert.fail("Providing contactFirstName with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
+       }
+
+       @Test (description = "Tests if an instance is created if houseNumber is null")
+       public void testNullContactHouseNumber () {
+               // Should not fail
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.FALSE,
+                                         ContactTestData.CONTACT_STREET_NAME1,
+                                         null,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
+                                         ContactTestData.CONTACT_ZIP_CODE1,
+                                         ContactTestData.CONTACT_CITY1,
+                                         ContactTestData.CONTACT_EMAIL1,
+                                         ContactTestData.CONTACT_TITLE1,
+                                         new Date(),
+                                         ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Set dummy mobile number instance
-               contact1.setContactMobileNumber(new MobileNumber());
-               contact1.getContactMobileNumber().setMobileId(1l);
-               contact2.setContactMobileNumber(new MobileNumber());
-               contact2.getContactMobileNumber().setMobileId(2l);
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests Contact.equals() with null and set primary key")
-       public void testEqualsNullContactId () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
+       @Test (description = "Tests if an instance is created if houseNumberExtension is null")
+       public void testNullContactHouseNumberExtension () {
+               // Should not fail
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.FALSE,
+                                         ContactTestData.CONTACT_STREET_NAME1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
+                                         null,
+                                         ContactTestData.CONTACT_ZIP_CODE1,
+                                         ContactTestData.CONTACT_CITY1,
+                                         ContactTestData.CONTACT_EMAIL1,
+                                         ContactTestData.CONTACT_TITLE1,
+                                         new Date(),
+                                         ContactTestData.CONTACT_COMMENT1
                          );
-               final Contact contact2 = new UserContact(
+
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
+       }
+
+       @Test (description = "Tests on an expected exception if contactLastName is null", expectedExceptions = NullPointerException.class)
+       public void testNullContactLastName () {
+               // Should throw an NPE
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
-                                         ContactTestData.CONTACT_LAST_NAME1,
+                                         null,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.TRUE
                          );
 
-               // Set dummy fax number instance
-               contact2.setContactId(-1l);
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
+               // Should never be reached
+               Assert.fail("Providing contactLastName with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
        }
 
-       @Test (description = "Tests Contact.equals() with different primary keys")
-       public void testEqualsDifferentContactId () {
-               // Create valid Contact instances
-               final Contact contact1 = new UserContact(
-                                         PersonalTitle.MR,
+       @Test (description = "Tests on an expected exception if contactPersonalTitle is null", expectedExceptions = NullPointerException.class)
+       public void testNullContactPersonalTitle () {
+               // Should throw an NPE
+               final Contact contact = new UserContact(
+                                         null,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.TRUE
                          );
-               final Contact contact2 = new UserContact(
+
+               // Should never be reached
+               Assert.fail("Providing contactPersonalTitle with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
+       }
+
+       @Test (description = "Tests if an instance is created if street name is null")
+       public void testNullContactStreetName () {
+               // Should not fail
+               final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.FALSE,
+                                         null,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
+                                         ContactTestData.CONTACT_ZIP_CODE1,
+                                         ContactTestData.CONTACT_CITY1,
+                                         ContactTestData.CONTACT_EMAIL1,
+                                         ContactTestData.CONTACT_TITLE1,
+                                         new Date(),
+                                         ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Set dummy fax number instance
-               contact1.setContactId(1l);
-               contact2.setContactId(2l);
-
-               // Should always be false
-               Assert.assertFalse(contact1.equals(contact2));
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests entryCreated getter/setter")
-       public void testEntryCreated () {
-               // Create valid Contact instance
+       @Test (description = "Tests if an instance is created if zipCode is null")
+       public void testNullContactZipCode () {
+               // Should not fail
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         Boolean.FALSE,
+                                         ContactTestData.CONTACT_STREET_NAME1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER1,
+                                         ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1,
+                                         null,
+                                         ContactTestData.CONTACT_CITY1,
+                                         ContactTestData.CONTACT_EMAIL1,
+                                         ContactTestData.CONTACT_TITLE1,
+                                         new Date(),
+                                         ContactTestData.CONTACT_COMMENT1
                          );
 
-               // Set entryCreated
-               contact.setContactEntryCreated(new Date());
-
-               // Should always be true
-               Assert.assertTrue(contact.getContactEntryCreated() instanceof Date);
+               // Should pass
+               Assert.assertTrue(contact instanceof Contact);
        }
 
-       @Test (description = "Tests entryUpdated getter/setter")
-       public void testEntryUpdated () {
-               // Create valid Contact instance
+       @Test (description = "Tests on an expected exception if isOwnContact is null", expectedExceptions = NullPointerException.class)
+       public void testNullIsOwnContact () {
+               // Should throw an NPE
                final Contact contact = new UserContact(
                                          PersonalTitle.MR,
                                          ContactTestData.CONTACT_FIRST_NAME1,
                                          ContactTestData.CONTACT_LAST_NAME1,
                                          ContactTestData.CONTACT_COUNTRY1,
-                                         Boolean.FALSE
+                                         null
                          );
 
-               // Set entryCreated
-               contact.setContactEntryUpdated(new Date());
-
-               // Should always be true
-               Assert.assertTrue(contact.getContactEntryUpdated() instanceof Date);
+               // Should never be reached
+               Assert.fail("Providing isOwnContact with a null reference should cause a NPE to be thrown: contact=" + contact); //NOI18N
        }
 
 }