|
|
@ -14,7 +14,28 @@ public class CustomersTest extends TestCase { |
|
|
|
|
|
|
|
// Then |
|
|
|
assertTrue(nicknameIsAvailable); |
|
|
|
} |
|
|
|
|
|
|
|
public void test_registerUser() { |
|
|
|
// Given |
|
|
|
Customers customers = new Customers(); |
|
|
|
String expectedNickNameInput = "Mougli"; |
|
|
|
User expectedNewUser = new User(expectedNickNameInput); |
|
|
|
|
|
|
|
// Add a user |
|
|
|
customers.registerUser(expectedNewUser); |
|
|
|
|
|
|
|
// Get the expected User |
|
|
|
User expectedUser = customers.getByNickname(expectedNickNameInput); |
|
|
|
assertTrue(null != expectedNewUser); |
|
|
|
String expectedNickNameGotBack = expectedUser.nickName; |
|
|
|
|
|
|
|
System.out.println(expectedNickNameGotBack); |
|
|
|
// When |
|
|
|
boolean userRegistered = expectedNickNameGotBack.equals(expectedNickNameInput); |
|
|
|
|
|
|
|
// Then |
|
|
|
assertTrue(userRegistered); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |