Browse Source

Added: Register Multiple Users Test

feature-pr/user
Maxim Volkov 3 years ago
parent
commit
a5d54b0ea6
  1. 35
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/CustomersTest.java

35
projjpn/src/test/java/de/hs_fulda/ciip/projjpn/CustomersTest.java

@ -37,4 +37,39 @@ public class CustomersTest extends TestCase {
assertTrue(userRegistered); assertTrue(userRegistered);
} }
/**
* Register multiple Users and then search for them in the same order.
*/
public void test_registerMultipleUsers() {
// Given
Customers customers = new Customers();
String[] expectedNickNamesInput = {"Mougli", "Tarkan", "beastMaster64", "BlaBlaPew", "MuchDoge_321"};
User[] expectedNewUsers = new User[expectedNickNamesInput.length];
for (int i = 0; i < expectedNickNamesInput.length; i++) {
// Create user
expectedNewUsers[i] = new User(expectedNickNamesInput[i]);
// Add user
customers.registerUser(expectedNewUsers[i]);
}
// Get the expected Users
User foundUser;
String expectedNickNameGotBack;
boolean userRegistered;
for (int i = 0; i < expectedNickNamesInput.length; i++) {
// Get user
foundUser = customers.getByNickname(expectedNickNamesInput[i]);
assertTrue(null != foundUser);
// When
expectedNickNameGotBack = foundUser.nickName;
userRegistered = expectedNickNameGotBack.equals(expectedNickNamesInput[i]);
// Then
assertTrue(userRegistered);
}
}
} }
Loading…
Cancel
Save