My expected and actual in my Assertionerror are showing the same thing. And they are the same reference. Anyone know why and how to fix? Code and error below. Thanks in advance:
@Test
public void test_CreateAUserWritesAFileReadsFilePrintsFile() throws IOException {
//Arrange
WriteCommand fwc = new FileWriteCommand();
ReadCommand frc = new FileReadCommand();
RegistrationController rc = new RegistrationController();
User user = new User("Jerry", "123", "Engineer");
rc.registerNewUser("Jerry", "123", "Engineer");
fwc.writeUser(user);
User one = frc.readUser("Jerry");
System.out.println(one);
User expected = one;
//Act
User actual = user;
//Assert
assertEquals(expected, actual);
}
Error
java.lang.AssertionError: expected: com.fdmgroup.userregistration.User<User [username=Jerry, password=123, role=Engineer]> but was: com.fdmgroup.userregistration.User<User [username=Jerry, password=123, role=Engineer]>