Browse Source

test_User creation in CreateUser, fixed error in CreateUser (public String surname() and public void setSurname(String surname))

remotes/origin/server
Richard Schmidt 11 months ago
parent
commit
945f4c33d9
  1. 6
      src/main/java/CreateUser.java
  2. 29
      src/test/java/CreateUsertTest.java

6
src/main/java/CreateUser.java

@ -77,11 +77,11 @@ class CreateUser {
}
public String surname() {
return firstName;
return surname;
}
public void surname(String firstName) {
this.firstName = firstName;
public void setSurname(String surname) {
this.surname = surname;
}
public boolean isStayLoggedIn() {

29
src/test/java/CreateUsertTest.java

@ -0,0 +1,29 @@
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class CreateUsertTest {
@Test
public void testCreateUser() {
String id = "1";
String userName = "testUser";
String password = "password123";
String birthday = "2000-01-01";
String firstName = "John";
String surname = "Doe";
CreateUser user = new CreateUser(id, userName, password, birthday, firstName, surname);
assertEquals(id, user.getId());
assertEquals(userName, user.getUserName());
assertEquals(birthday, user.getBirthday());
assertEquals(firstName, user.getFirstName());
assertEquals(surname, user.surname());
// Password should be hashed
assertNotEquals(password, user.getPassword());
}
}
Loading…
Cancel
Save