From 122e446b3b8513c70543807529a3fdc062decb75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 5 Nov 2022 05:30:08 +0100 Subject: [PATCH] Continued: - added unit tests for UserContact class as an object (no entity-related tests) - introduced data constant class ContactTestData - sorted members in 2nd optional constructor - also removed some superflous/untestable --- nbproject/project.properties | 3 +- .../jcontacts/model/contact/UserContact.java | 63 +- .../mxchange/jcontacts/ContactTestData.java | 98 ++ .../model/contact/UserContactObjectTest.java | 941 ++++++++++++++++++ .../model/utils/ContactUtilsTest.java | 688 ++++++------- 5 files changed, 1397 insertions(+), 396 deletions(-) create mode 100644 test/org/mxchange/jcontacts/ContactTestData.java create mode 100644 test/org/mxchange/jcontacts/model/contact/UserContactObjectTest.java diff --git a/nbproject/project.properties b/nbproject/project.properties index d5d16d5..bfb9a2b 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -53,7 +53,8 @@ javac.source=1.7 javac.target=1.7 javac.test.classpath=\ ${javac.classpath}:\ - ${build.classes.dir} + ${build.classes.dir}:\ + ${libs.testng.classpath} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= diff --git a/src/org/mxchange/jcontacts/model/contact/UserContact.java b/src/org/mxchange/jcontacts/model/contact/UserContact.java index 89f8924..a34c684 100644 --- a/src/org/mxchange/jcontacts/model/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/model/contact/UserContact.java @@ -228,51 +228,51 @@ public class UserContact implements Contact { /** * Constructor for title and names *

- * @param contactPersonalTitle Personal title - * @param contactFirstName First name - * @param contactFamilyName Family name - * @param contactCountry Country instance - * @param isOwnContact Whether this is own contact + * @param personalTitle Personal title + * @param firstName First name + * @param familyName Family name + * @param country Country instance + * @param isOwnContact Whether this is own contact */ - public UserContact (final PersonalTitle contactPersonalTitle, final String contactFirstName, final String contactFamilyName, final Country contactCountry, final Boolean isOwnContact) { + public UserContact (final PersonalTitle personalTitle, final String firstName, final String familyName, final Country country, final Boolean isOwnContact) { // Invoke default constructor this(); // Are all parameter set? - if (null == contactPersonalTitle) { + if (null == personalTitle) { // Throw NPE - throw new NullPointerException("contactPersonalTitle is null"); //NOI18N - } else if (null == contactFirstName) { + throw new NullPointerException("personalTitle is null"); //NOI18N + } else if (null == firstName) { // Throw NPE - throw new NullPointerException("contactFirstName is null"); //NOI18N - } else if (contactFirstName.isEmpty()) { + throw new NullPointerException("firstName is null"); //NOI18N + } else if (firstName.isEmpty()) { // Throw IAE - throw new IllegalArgumentException("contactFirstName is empty"); //NOI18N - } else if (null == contactFamilyName) { + throw new IllegalArgumentException("firstName is empty"); //NOI18N + } else if (null == familyName) { // Throw NPE - throw new NullPointerException("contactFamilyName is null"); //NOI18N - } else if (contactFamilyName.isEmpty()) { + throw new NullPointerException("familyName is null"); //NOI18N + } else if (familyName.isEmpty()) { // Throw IAE - throw new IllegalArgumentException("contactFamilyName is empty"); //NOI18N - } else if (null == contactCountry) { + throw new IllegalArgumentException("familyName is empty"); //NOI18N + } else if (null == country) { // Throw NPE - throw new NullPointerException("contactCountry is null"); //NOI18N - } else if (contactCountry.getCountryId() == null) { + throw new NullPointerException("country is null"); //NOI18N + } else if (country.getCountryId() == null) { // Throw it again - throw new NullPointerException("contactCountry.countryId is null"); //NOI18N - } else if (contactCountry.getCountryId() < 1) { + throw new NullPointerException("country.countryId is null"); //NOI18N + } else if (country.getCountryId() < 1) { // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("contactCountry.countryId={0} is not valid", contactCountry.getCountryId())); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("contactCountry.countryId={0} is not valid", country.getCountryId())); //NOI18N } else if (null == isOwnContact) { // Throw NPE throw new NullPointerException("isOwnContact is null"); // NOI18N } // Set all - this.contactPersonalTitle = contactPersonalTitle; - this.contactFirstName = contactFirstName; - this.contactFamilyName = contactFamilyName; - this.contactCountry = contactCountry; + this.contactPersonalTitle = personalTitle; + this.contactFirstName = firstName; + this.contactFamilyName = familyName; + this.contactCountry = country; this.contactOwnContact = isOwnContact; } @@ -283,6 +283,7 @@ public class UserContact implements Contact { * @param firstName First name * @param familyName Family name * @param country Country (e.g. current) + * @param isOwnContact Whether this is own contact * @param street Street name * @param houseNumber House number * @param houseNumberExtension Extension to house number (e.g. a in 12a) @@ -292,11 +293,10 @@ public class UserContact implements Contact { * @param academicTitle Academic title * @param birthday Birthday * @param comment Comment - * @param isOwnContact Whether this is own contact *

* @todo Find a way to stop 0000-00-00 as birthdays to be entered */ - public UserContact (final PersonalTitle personalTitle, final String firstName, final String familyName, final Country country, final String street, final Short houseNumber, final String houseNumberExtension, final Integer zipCode, final String city, final String emailAddress, final String academicTitle, final Date birthday, final String comment, final Boolean isOwnContact) { + public UserContact (final PersonalTitle personalTitle, final String firstName, final String familyName, final Country country, final Boolean isOwnContact, final String street, final Short houseNumber, final String houseNumberExtension, final Integer zipCode, final String city, final String emailAddress, final String academicTitle, final Date birthday, final String comment) { // Call other constructor first this(personalTitle, firstName, familyName, country, isOwnContact); @@ -304,13 +304,13 @@ public class UserContact implements Contact { if (street != null && street.isEmpty()) { // Throw IAE throw new IllegalArgumentException("street is empty"); // NOI18N - } else if (houseNumber != null && houseNumber < 0) { + } else if (houseNumber != null && houseNumber < 1) { // No zero house numbers exist throw new IllegalArgumentException(MessageFormat.format("houseNumber={0} is not valid", houseNumber)); // NOI18N } else if (houseNumberExtension != null && houseNumberExtension.isEmpty()) { // Throw IAE throw new IllegalArgumentException("houseNumberExtension is empty"); // NOI18N - } else if (zipCode != null && zipCode < 0) { + } else if (zipCode != null && zipCode < 1) { // No zero house numbers exist throw new IllegalArgumentException(MessageFormat.format("zipCode={0} is not valid", zipCode)); // NOI18N } else if (city != null && city.isEmpty()) { @@ -397,9 +397,6 @@ public class UserContact implements Contact { return false; } else if (this.getClass() != object.getClass()) { return false; - } else if (!(object instanceof Contact)) { - // Not correct interface - return false; } final Contact contact = (Contact) object; diff --git a/test/org/mxchange/jcontacts/ContactTestData.java b/test/org/mxchange/jcontacts/ContactTestData.java new file mode 100644 index 0000000..05cff2f --- /dev/null +++ b/test/org/mxchange/jcontacts/ContactTestData.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2022 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontacts; + +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jcountry.model.data.CountryData; + +/** + * A class that holds all test data + *

+ * @author Roland Häder + */ +public class ContactTestData { + + public static final String CONTACT_CITY1 = "Chicago"; //NOI18N + + public static final String CONTACT_CITY2 = "New York"; //NOI18N + + public static final String CONTACT_COMMENT1 = "A tester user"; //NOI18N + + public static final String CONTACT_COMMENT2 = "A testing user"; //NOI18N + + public static final Country CONTACT_COUNTRY1 = new CountryData( + "+", //NOI18N + "DE", //NOI18N + "0", //NOI18N + "COUNTRY_GERMANY", + Boolean.FALSE, + Short.valueOf("49") //NOI18N + ); + + public static final Country CONTACT_COUNTRY2 = new CountryData( + "+", //NOI18N + "US", //NOI18N + "0", //NOI18N + "COUNTRY_USA", //NOI18N + Boolean.FALSE, + Short.valueOf("1") //NOI18N + ); + + public static final String CONTACT_EMAIL1 = "bob@example.org"; //NOI18N + + public static final String CONTACT_EMAIL2 = "bob@company.com"; //NOI18N + + public static final String CONTACT_FIRST_NAME1 = "Bob"; //NOI18N + + public static final String CONTACT_FIRST_NAME2 = "Alice"; //NOI18N + + public static final Short CONTACT_HOUSE_NUMBER1 = 123; + + public static final Short CONTACT_HOUSE_NUMBER2 = 456; + + public static final String CONTACT_HOUSE_NUMBER_EXTENSION1 = "a"; //NOI18N + + public static final String CONTACT_HOUSE_NUMBER_EXTENSION2 = "b"; //NOI18N + + public static final String CONTACT_LAST_NAME1 = "Johnson"; //NOI18N + + public static final String CONTACT_LAST_NAME2 = "Andrews"; //NOI18N + + public static final String CONTACT_STREET_NAME1 = "Park Street"; //NOI18N + + public static final String CONTACT_STREET_NAME2 = "Sunshine Strip"; //NOI18N + + public static final String CONTACT_TITLE1 = "Dr."; //NOI18N + + public static final String CONTACT_TITLE2 = "PHD"; //NOI18N + + public static final Integer CONTACT_ZIP_CODE1 = 12345; + + public static final Integer CONTACT_ZIP_CODE2 = 67890; + + static { + // Fake ids + ContactTestData.CONTACT_COUNTRY1.setCountryId(1l); + ContactTestData.CONTACT_COUNTRY2.setCountryId(2l); + } + + /** + * No instance required as only public static fields are here + */ + private ContactTestData () { + } +} diff --git a/test/org/mxchange/jcontacts/model/contact/UserContactObjectTest.java b/test/org/mxchange/jcontacts/model/contact/UserContactObjectTest.java new file mode 100644 index 0000000..adf4fcb --- /dev/null +++ b/test/org/mxchange/jcontacts/model/contact/UserContactObjectTest.java @@ -0,0 +1,941 @@ +/* + * Copyright (C) 2022 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontacts.model.contact; + +import java.util.Date; +import org.mxchange.jcontacts.ContactTestData; +import org.mxchange.jcontacts.model.contact.title.PersonalTitle; +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber; +import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber; +import org.testng.Assert; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** + * Test cases for ContactUtils class + *

+ * @author Roland Häder + */ +public class UserContactObjectTest { + + /* + * @DataProvider (name = "different-contact-provider") public Object[][] + * createDifferentContacts () { } + */ + /** + * Default constructor + */ + public UserContactObjectTest () { + } + + @DataProvider (name = "same-contact-provider") + public Object[][] createSameContacts () { + return new Object[][]{ + {new UserContact(), new UserContact()}, + {new UserContact( + PersonalTitle.MR, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE + ), new UserContact( + PersonalTitle.MR, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE + ) + }}; + } + + @AfterMethod (description = "Resets test data to its original values") + public void resetTestData () { + ContactTestData.CONTACT_COUNTRY1.setCountryId(1l); + } + + @Test (description = "Tests Contact.compareTo() with same contact", dataProvider = "same-contact-provider") + public void testCompareToSameContact (final Contact contact1, final Contact contact2) { + // Should always be zero + Assert.assertEquals(contact1.compareTo(contact2), 0); + } + + @Test (description = "Tests Contact.compareTo() with same instance", dataProvider = "same-contact-provider") + public void testCompareToSameInstance (final Contact contact1, final Contact contact2) { + // Should always be zero + Assert.assertEquals(contact1.compareTo(contact1), 0); + } + + @Test (description = "Tests if Contact.compareTo() throws an expected exception", expectedExceptions = NullPointerException.class) + public void testCompareToSameInstance () { + // Init contact instance + final Contact contact = new UserContact(); + + // Should cause an NPE + final int compared = contact.compareTo(null); + + // Should never be reached + Assert.fail("Comparing a Contact instance with null should always throw a NPE: compared=" + compared); + } + + @Test (description = "Tests on an expected exception if academicTitle is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactAcademicTitle () { + // Should throw an NPE + 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, + "", // NOI18N + new Date(), + ContactTestData.CONTACT_COMMENT1 + ); + + // Should never be reached + Assert.fail("Providing academicTitle with an empty string should cause an IAE to be thrown: contact=" + contact); //NOI18N + } + + @Test (description = "Tests on an expected exception if city is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactCityName () { + // Should throw an NPE + 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, + "", // NOI18N + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, + new Date(), + ContactTestData.CONTACT_COMMENT1 + ); + + // Should never be reached + Assert.fail("Providing city with an empty string should cause an IAE to be thrown: contact=" + contact); //NOI18N + } + + @Test (description = "Tests on an expected exception if comment is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactComment () { + // Should throw an NPE + 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(), + "" // NOI18N + ); + + // Should never be reached + 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 emailAddress is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactEmailAddress () { + // Should throw an NPE + 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, + "", // NOI18N + ContactTestData.CONTACT_TITLE1, + new Date(), + ContactTestData.CONTACT_COMMENT1 + ); + + // Should never be reached + Assert.fail("Providing city with an empty string should cause an IAE to be thrown: contact=" + contact); //NOI18N + } + + @Test (description = "Tests on an expected exception if contactFirstName is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactFirstName () { + // Should throw an NPE + final Contact contact = new UserContact( + PersonalTitle.MR, + "", // NOI18N + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.TRUE + ); + + // Should never be reached + Assert.fail("Providing contactFirstName with an empty string should cause an IAE to be thrown: contact=" + contact); //NOI18N + } + + @Test (description = "Tests on an expected exception if street is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactHouseNumberExtension () { + // Should throw an NPE + 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, + "", // NOI18N + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, + new Date(), + ContactTestData.CONTACT_COMMENT1 + ); + + // 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 on an expected exception if contactLastName is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactLastName () { + // Should throw an NPE + final Contact contact = new UserContact( + PersonalTitle.MR, + ContactTestData.CONTACT_FIRST_NAME1, + "", // NOI18N + ContactTestData.CONTACT_COUNTRY1, + Boolean.TRUE + ); + + // Should never be reached + Assert.fail("Providing contactLastName with an empty string should cause an IAE to be thrown: contact=" + contact); //NOI18N + } + + @Test (description = "Tests on an expected exception if street is empty", expectedExceptions = IllegalArgumentException.class) + public void testEmptyContactStreetName () { + // Should throw an NPE + final Contact contact = new UserContact( + PersonalTitle.MR, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE, + "", //NOI18N + 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 + ); + + // Should never be reached + 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; + + // Set invalid countryId + country.setCountryId(-1l); + + // Should cause an NPE + final Contact contact = new UserContact( + PersonalTitle.MR, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + country, + 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 + } + + @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, + 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 + ); + + // Should never be reached + Assert.fail("Providing houseNumber with an invalid value should cause an IAE to be thrown: contact=" + contact); //NOI18N + } + + @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, + 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 + ); + + // 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 academicTitle is null") + public void testNullContactAcademicTitle () { + // Should not fail + 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, + null, + new Date(), + ContactTestData.CONTACT_COMMENT1 + ); + + // Should pass + Assert.assertTrue(contact instanceof Contact); + } + + @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, + 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 + ); + + // Should pass + Assert.assertTrue(contact instanceof Contact); + } + + @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, + 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 + ); + + // Should pass + Assert.assertTrue(contact instanceof Contact); + } + + @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, + 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 + ); + + // 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, + null, + Boolean.TRUE + ); + + // 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 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, + country, + Boolean.FALSE + ); + + // 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, + 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 + ); + + // 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 + } + + @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, + 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 + ); + + // Should pass + Assert.assertTrue(contact instanceof Contact); + } + + @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, + 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 + ); + + // 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, + 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 () { + // Should not fail + final Contact contact = new UserContact( + PersonalTitle.MR, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + 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 + ); + + // Should pass + Assert.assertTrue(contact instanceof Contact); + } + + @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, + 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 + ); + + // 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 + ); + + // Set dummy landLine number instance + contact2.setContactLandLineNumber(new LandLineNumber()); + + // Should always be false + Assert.assertFalse(contact1.equals(contact2)); + } + + @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 + ); + 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 + 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 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 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 + ); + 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 + 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 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 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 + ); + 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.setContactId(1l); + contact2.setContactId(2l); + + // Should always be false + Assert.assertFalse(contact1.equals(contact2)); + } + + @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 entryCreated + contact.setContactEntryCreated(new Date()); + + // 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, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE + ); + + // Set entryCreated + contact.setContactEntryUpdated(new Date()); + + // Should always be true + Assert.assertTrue(contact.getContactEntryUpdated() instanceof Date); + } + +} diff --git a/test/org/mxchange/jcontacts/model/utils/ContactUtilsTest.java b/test/org/mxchange/jcontacts/model/utils/ContactUtilsTest.java index 96e73be..3ed874d 100644 --- a/test/org/mxchange/jcontacts/model/utils/ContactUtilsTest.java +++ b/test/org/mxchange/jcontacts/model/utils/ContactUtilsTest.java @@ -19,12 +19,12 @@ package org.mxchange.jcontacts.model.utils; import java.util.Calendar; import java.util.Date; import java.util.Objects; +import org.mxchange.jcontacts.ContactTestData; import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontacts.model.contact.UserContact; import org.mxchange.jcontacts.model.contact.title.PersonalTitle; -import org.mxchange.jcountry.model.data.Country; -import org.mxchange.jcountry.model.data.CountryData; import org.testng.Assert; +import org.testng.annotations.AfterMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -35,46 +35,6 @@ import org.testng.annotations.Test; */ public class ContactUtilsTest { - private static final Country CONTACT_COUNTRY1 = new CountryData( - "+", //NOI18N - "DE", //NOI18N - "0", //NOI18N - "COUNTRY_GERMANY", //NOI18N - Boolean.FALSE, - Short.valueOf("49") //NOI18N - ); - - private static final Country CONTACT_COUNTRY2 = new CountryData( - "+", //NOI18N - "US", //NOI18N - "0", //NOI18N - "COUNTRY_USA", //NOI18N - Boolean.FALSE, - Short.valueOf("1") //NOI18N - ); - - private static final String CONTACT_FIRST_NAME1 = "Bob"; //NOI18N - - private static final String CONTACT_FIRST_NAME2 = "Alice"; //NOI18N - - private static final Short CONTACT_HOUSE_NUMBER1 = 123; - - private static final Short CONTACT_HOUSE_NUMBER2 = 456; - - private static final String CONTACT_LAST_NAME1 = "Johnson"; //NOI18N - - private static final String CONTACT_LAST_NAME2 = "Andrews"; - - private static final String CONTACT_STREET_NAME1 = "Park Street"; //NOI18N - - private static final String CONTACT_STREET_NAME2 = "Sunshine Strip"; //NOI18N - - static { - // Fake ids - CONTACT_COUNTRY1.setCountryId(1l); - CONTACT_COUNTRY2.setCountryId(2l); - } - /** * Default constructor */ @@ -93,447 +53,446 @@ public class ContactUtilsTest { // Different personal title {new UserContact( PersonalTitle.MRS, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ) // Different first name }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME2, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME2, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ) // Different family name }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), new UserContact( PersonalTitle.MRS, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME2, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME2, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ) // Different country }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY2, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY2, Boolean.FALSE ) // Different "is own" flag }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.TRUE ) // All optional fields (except fax, land-line and mobile number) versus required fields only filled out }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ) // Different street }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME2, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE, + ContactTestData.CONTACT_STREET_NAME2, //NOI18N + ContactTestData.CONTACT_HOUSE_NUMBER1, + ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1, + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different house number }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER2, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE, + ContactTestData.CONTACT_STREET_NAME1, + ContactTestData.CONTACT_HOUSE_NUMBER2, + ContactTestData.CONTACT_HOUSE_NUMBER_EXTENSION1, + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different house number extension (both set) }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "b", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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_EXTENSION2, + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE - ) - // Different house number extension (left null) + ContactTestData.CONTACT_COMMENT1 + ) // Different house number extension (left null) }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE, + ContactTestData.CONTACT_STREET_NAME1, + ContactTestData.CONTACT_HOUSE_NUMBER1, null, //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "b", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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_EXTENSION2, + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different house number extension (right null) }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, + Boolean.FALSE, + ContactTestData.CONTACT_STREET_NAME1, + ContactTestData.CONTACT_HOUSE_NUMBER1, null, //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + ContactTestData.CONTACT_ZIP_CODE1, + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different ZIP code }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N + 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, 67890, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + ContactTestData.CONTACT_CITY1, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different city }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "New York", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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_CITY2, + ContactTestData.CONTACT_EMAIL1, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different email address }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@company.com", //NOI18N - "Dr.", //NOI18N + 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_EMAIL2, + ContactTestData.CONTACT_TITLE1, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different accdemical title }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "PHD", //NOI18N + 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_TITLE2, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different birthday }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, calendar.getTime(), - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ) // Different comment }, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr.", //NOI18N + 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, date, - "A tester user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT1 ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, - CONTACT_STREET_NAME1, //NOI18N - CONTACT_HOUSE_NUMBER1, - "a", //NOI18N - 12345, - "Chicago", //NOI18N - "bob@example.org", //NOI18N - "Dr,", //NOI18N + 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, date, - "A testing user", //NOI18N - Boolean.FALSE + ContactTestData.CONTACT_COMMENT2 ) }}; } @@ -544,9 +503,9 @@ public class ContactUtilsTest { {null, new UserContact()}, {null, new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ) }}; @@ -558,9 +517,9 @@ public class ContactUtilsTest { {new UserContact(), null}, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), null }}; @@ -572,20 +531,25 @@ public class ContactUtilsTest { {new UserContact(), new UserContact()}, {new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ), new UserContact( PersonalTitle.MR, - CONTACT_FIRST_NAME1, - CONTACT_LAST_NAME1, - CONTACT_COUNTRY1, + ContactTestData.CONTACT_FIRST_NAME1, + ContactTestData.CONTACT_LAST_NAME1, + ContactTestData.CONTACT_COUNTRY1, Boolean.FALSE ) }}; } + @AfterMethod (description = "Resets test data to its original values") + public void resetTestData () { + ContactTestData.CONTACT_COUNTRY1.setCountryId(1l); + } + @Test (description = "Tests if comparing different contacts returns expected value", dataProvider = "different-contact-provider") public void testCompareDifferentContact (final Contact contact1, final Contact contact2) { // Should be never zero -- 2.39.5