|
@ -26,10 +26,10 @@ public class CustomersTest extends TestCase { |
|
|
customers.registerUser(userToRegister); |
|
|
customers.registerUser(userToRegister); |
|
|
|
|
|
|
|
|
// When |
|
|
// When |
|
|
boolean nicknameIsTaken = !customers.nickNameAvailable(availableNickname); |
|
|
|
|
|
|
|
|
boolean nicknameIsTaken = customers.nickNameAvailable(availableNickname); |
|
|
|
|
|
|
|
|
// Then |
|
|
// Then |
|
|
assertTrue(nicknameIsTaken); |
|
|
|
|
|
|
|
|
assertFalse(nicknameIsTaken); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void test_registerSingleUser() { |
|
|
public void test_registerSingleUser() { |
|
@ -43,7 +43,8 @@ public class CustomersTest extends TestCase { |
|
|
|
|
|
|
|
|
// Get the expected User |
|
|
// Get the expected User |
|
|
User expectedUser = customers.getByNickname(expectedNickNameInput); |
|
|
User expectedUser = customers.getByNickname(expectedNickNameInput); |
|
|
assertTrue(null != expectedNewUser); |
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
assertNotNull(expectedNewUser); |
|
|
String expectedNickNameGotBack = expectedUser.nickName; |
|
|
String expectedNickNameGotBack = expectedUser.nickName; |
|
|
|
|
|
|
|
|
// When |
|
|
// When |
|
@ -78,7 +79,7 @@ public class CustomersTest extends TestCase { |
|
|
for (int i = 0; i < expectedNickNamesInput.length; i++) { |
|
|
for (int i = 0; i < expectedNickNamesInput.length; i++) { |
|
|
// Get user |
|
|
// Get user |
|
|
foundUser = customers.getByNickname(expectedNickNamesInput[i]); |
|
|
foundUser = customers.getByNickname(expectedNickNamesInput[i]); |
|
|
assertTrue(null != foundUser); |
|
|
|
|
|
|
|
|
assertNotNull(foundUser); |
|
|
|
|
|
|
|
|
// When |
|
|
// When |
|
|
expectedNickNameGotBack = foundUser.nickName; |
|
|
expectedNickNameGotBack = foundUser.nickName; |
|
@ -97,8 +98,8 @@ public class CustomersTest extends TestCase { |
|
|
customers.registerUser(userToRegister); |
|
|
customers.registerUser(userToRegister); |
|
|
|
|
|
|
|
|
// When |
|
|
// When |
|
|
boolean userExists = !customers.nickNameAvailable(userToRemove); |
|
|
|
|
|
assertTrue(userExists); |
|
|
|
|
|
|
|
|
boolean userExists = customers.nickNameAvailable(userToRemove); |
|
|
|
|
|
assertFalse(userExists); |
|
|
|
|
|
|
|
|
// Then |
|
|
// Then |
|
|
User removedUser = customers.deleteUser(userToRemove); |
|
|
User removedUser = customers.deleteUser(userToRemove); |
|
@ -139,11 +140,7 @@ public class CustomersTest extends TestCase { |
|
|
|
|
|
|
|
|
User gotUser = customers.getByNickname(nickName); |
|
|
User gotUser = customers.getByNickname(nickName); |
|
|
|
|
|
|
|
|
// When |
|
|
|
|
|
boolean foundUser = null != gotUser; |
|
|
|
|
|
|
|
|
|
|
|
// Then |
|
|
|
|
|
assertTrue(foundUser); |
|
|
|
|
|
|
|
|
assertNotNull(gotUser); |
|
|
|
|
|
|
|
|
// When |
|
|
// When |
|
|
boolean correctFirstName = "Mia".equals(gotUser.getFirstName()); |
|
|
boolean correctFirstName = "Mia".equals(gotUser.getFirstName()); |
|
|