|
|
@ -120,7 +120,46 @@ public class CustomersTest extends TestCase { |
|
|
|
} |
|
|
|
actualRegisteredUsers = customers.getCountOfUsers(); |
|
|
|
assertEquals(expectedRegisteredUsers, actualRegisteredUsers); |
|
|
|
} |
|
|
|
|
|
|
|
public void test_createRegisterAndCheckUserData() { |
|
|
|
// Given |
|
|
|
Customers customers = new Customers(); |
|
|
|
|
|
|
|
String firstName = "Mia"; |
|
|
|
String lastName = "Muster"; |
|
|
|
String nickName = "harley"; |
|
|
|
String eMail = "mia@muster.de"; |
|
|
|
Birthdate birthdate = new Birthdate(30, 12, 1997); |
|
|
|
|
|
|
|
User userToCheck = new User(firstName, lastName, nickName, eMail, birthdate); |
|
|
|
|
|
|
|
// Register User |
|
|
|
customers.registerUser(userToCheck); |
|
|
|
|
|
|
|
User gotUser = customers.getByNickname(nickName); |
|
|
|
|
|
|
|
// When |
|
|
|
boolean foundUser = null != gotUser; |
|
|
|
|
|
|
|
// Then |
|
|
|
assertTrue(foundUser); |
|
|
|
|
|
|
|
// When |
|
|
|
boolean correctFirstName = "Mia".equals(gotUser.getFirstName()); |
|
|
|
boolean correctLastName = "Muster".equals(gotUser.getLastName()); |
|
|
|
boolean correctNickName = "harley".equals(gotUser.getNickName()); |
|
|
|
boolean correctEMail = "mia@muster.de".equals(gotUser.geteMail()); |
|
|
|
boolean correctBirthdate = birthdate.toString().equals(gotUser.birthdate.toString()); |
|
|
|
|
|
|
|
// Then |
|
|
|
assertTrue(correctFirstName); |
|
|
|
assertTrue(correctLastName); |
|
|
|
assertTrue(correctNickName); |
|
|
|
assertTrue(correctEMail); |
|
|
|
assertTrue(correctBirthdate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |