Assert.fail("Providing a null for Parameter userName should always throw a NPE. user=" + user); //NOI18N
}
- @Test (description = "Tests method User.compareTo() with different User instance", dataProvider = "different-user-provider")
- public void testUserCompareToDifferentserInstance (final User user1, final User user2) {
- // Should always be zero
- Assert.assertNotEquals(user1.compareTo(user2), 0);
- }
-
- @Test (description = "Tests method User.compareTo() with different userLastLocked set", dataProvider = "same-user-provider")
- public void testUserCompareToDifferentserLastLocked (final User user1, final User user2) {
- // Set userLastLocked
- user2.setUserLastLocked(new Date());
+ @Test (description = "Tests method User.equals() with different userConfirmKey set", dataProvider = "same-user-provider")
+ public void testUser1EqualsToDifferentUserConfirmKey (final User user1, final User user2) {
+ // Set userConfirmKey
+ user1.setUserConfirmKey(UserTestData.USER_CONFIRM_KEY);
- // Should always be zero
- Assert.assertNotEquals(user1.compareTo(user2), 0);
+ // Should always be false
+ Assert.assertFalse(user1.equals(user2));
- // Set userLastLocked back to null
- user2.setUserLastLocked(null);
+ // Set userConfirmKey back to null
+ user1.setUserConfirmKey(null);
}
- @Test (description = "Tests method User.compareTo() with a null user", dataProvider = "one-user-provider", expectedExceptions = NullPointerException.class)
- public void testUserCompareToNullUser (final User user1) {
- // Should throw an exception
- final int comparison = user1.compareTo(null);
+ @Test (description = "Tests method User.equals() with different userId set", dataProvider = "same-user-provider")
+ public void testUser1EqualsToDifferentUserId (final User user1, final User user2) {
+ // Set userId
+ user1.setUserId(1l);
- // Should never be reached
- Assert.fail("Providing a null reference to User.compareTo() should always throw a NPE. comparison=" + comparison);
+ // Should always be false
+ Assert.assertFalse(user1.equals(user2));
+
+ // Set userId back to null
+ user1.setUserId(null);
}
- @Test (description = "Tests method User.compareTo() with same User instance", dataProvider = "same-user-provider")
- public void testUserCompareToSameUserInstance (final User user1, final User user2) {
- // Should always be zero
- Assert.assertEquals(user1.compareTo(user2), 0);
+ @Test (description = "Tests method User.equals() with different User instance", dataProvider = "different-user-provider")
+ public void testUser1EqualsToDifferentUserInstance (final User user1, final User user2) {
+ // Should always be false
+ Assert.assertFalse(user1.equals(user2));
}
- @Test (description = "Tests method User.equals() with same User instance", dataProvider = "one-user-provider")
- public void testUserEqualsNullUserInstance (final User user) {
+ @Test (description = "Tests method User.equals() with different userLastLocked set", dataProvider = "same-user-provider")
+ public void testUser1EqualsToDifferentUserLastLocked (final User user1, final User user2) {
+ // Set userLastLocked
+ user1.setUserLastLocked(new Date());
+
// Should always be false
- Assert.assertFalse(user.equals(null));
+ Assert.assertFalse(user1.equals(user2));
+
+ // Set userLastLocked back to null
+ user1.setUserLastLocked(null);
}
- @Test (description = "Tests method User.equals() with same User instance", dataProvider = "one-user-provider")
- public void testUserEqualsOtherInstance (final User user) {
+ @Test (description = "Tests method User.equals() with different userLastLockedReason set", dataProvider = "same-user-provider")
+ public void testUser1EqualsToDifferentUserLastLockedReason (final User user1, final User user2) {
+ // Set userLastLockedReason
+ user1.setUserLastLockedReason("Some test reason");
+
// Should always be false
- Assert.assertFalse(user.equals(this));
+ Assert.assertFalse(user1.equals(user2));
+
+ // Set userLastLockedReason back to null
+ user1.setUserLastLockedReason(null);
}
- @Test (description = "Tests method User.equals() with same User instance", dataProvider = "same-user-provider")
- public void testUserEqualsSameUserInstance (final User user1, final User user2) {
- // Should always be true
- Assert.assertTrue(user1.equals(user2));
+ @Test (description = "Tests method User.equals() with different userLocale set", dataProvider = "same-user-provider")
+ public void testUser1EqualsToDifferentUserLocale (final User user1, final User user2) {
+ // Set userLocale
+ user1.setUserLocale(Locale.FRANCE);
+
+ // Should always be false
+ Assert.assertFalse(user1.equals(user2));
+
+ // Set userLocale back to null
+ user1.setUserLocale(null);
}
@Test (description = "Tests method User.equals() with different userConfirmKey set", dataProvider = "same-user-provider")
- public void testUserEqualsToDifferentUserConfirmKey (final User user1, final User user2) {
+ public void testUser2EqualsToDifferentUserConfirmKey (final User user1, final User user2) {
// Set userConfirmKey
user2.setUserConfirmKey(UserTestData.USER_CONFIRM_KEY);
}
@Test (description = "Tests method User.equals() with different userId set", dataProvider = "same-user-provider")
- public void testUserEqualsToDifferentUserId (final User user1, final User user2) {
+ public void testUser2EqualsToDifferentUserId (final User user1, final User user2) {
// Set userId
user2.setUserId(1l);
}
@Test (description = "Tests method User.equals() with different User instance", dataProvider = "different-user-provider")
- public void testUserEqualsToDifferentUserInstance (final User user1, final User user2) {
+ public void testUser2EqualsToDifferentUserInstance (final User user1, final User user2) {
// Should always be false
Assert.assertFalse(user1.equals(user2));
}
@Test (description = "Tests method User.equals() with different userLastLocked set", dataProvider = "same-user-provider")
- public void testUserEqualsToDifferentUserLastLocked (final User user1, final User user2) {
+ public void testUser2EqualsToDifferentUserLastLocked (final User user1, final User user2) {
// Set userLastLocked
user2.setUserLastLocked(new Date());
}
@Test (description = "Tests method User.equals() with different userLastLockedReason set", dataProvider = "same-user-provider")
- public void testUserEqualsToDifferentUserLastLockedReason (final User user1, final User user2) {
+ public void testUser2EqualsToDifferentUserLastLockedReason (final User user1, final User user2) {
// Set userLastLockedReason
user2.setUserLastLockedReason("Some test reason");
}
@Test (description = "Tests method User.equals() with different userLocale set", dataProvider = "same-user-provider")
- public void testUserEqualsToDifferentUserLocale (final User user1, final User user2) {
+ public void testUser2EqualsToDifferentUserLocale (final User user1, final User user2) {
// Set userLocale
user2.setUserLocale(Locale.FRANCE);
user2.setUserLocale(null);
}
+ @Test (description = "Tests method User.compareTo() with different User instance", dataProvider = "different-user-provider")
+ public void testUserCompareToDifferentserInstance (final User user1, final User user2) {
+ // Should always be zero
+ Assert.assertNotEquals(user1.compareTo(user2), 0);
+ }
+
+ @Test (description = "Tests method User.compareTo() with different userLastLocked set", dataProvider = "same-user-provider")
+ public void testUserCompareToDifferentserLastLocked (final User user1, final User user2) {
+ // Set userLastLocked
+ user2.setUserLastLocked(new Date());
+
+ // Should always be zero
+ Assert.assertNotEquals(user1.compareTo(user2), 0);
+
+ // Set userLastLocked back to null
+ user2.setUserLastLocked(null);
+ }
+
+ @Test (description = "Tests method User.compareTo() with a null user", dataProvider = "one-user-provider", expectedExceptions = NullPointerException.class)
+ public void testUserCompareToNullUser (final User user1) {
+ // Should throw an exception
+ final int comparison = user1.compareTo(null);
+
+ // Should never be reached
+ Assert.fail("Providing a null reference to User.compareTo() should always throw a NPE. comparison=" + comparison);
+ }
+
+ @Test (description = "Tests method User.compareTo() with same User instance", dataProvider = "same-user-provider")
+ public void testUserCompareToSameUserInstance (final User user1, final User user2) {
+ // Should always be zero
+ Assert.assertEquals(user1.compareTo(user2), 0);
+ }
+
+ @Test (description = "Tests method User.equals() with same User instance", dataProvider = "one-user-provider")
+ public void testUserEqualsNullUserInstance (final User user) {
+ // Should always be false
+ Assert.assertFalse(user.equals(null));
+ }
+
+ @Test (description = "Tests method User.equals() with same User instance", dataProvider = "one-user-provider")
+ public void testUserEqualsOtherInstance (final User user) {
+ // Should always be false
+ Assert.assertFalse(user.equals(this));
+ }
+
+ @Test (description = "Tests method User.equals() with same User instance", dataProvider = "same-user-provider")
+ public void testUserEqualsSameUserInstance (final User user1, final User user2) {
+ // Should always be true
+ Assert.assertTrue(user1.equals(user2));
+ }
+
}