Hi Haroen,
Sorry I wasn't able to reply sooner.
You're right, the issue is that the id is undefined. Unfortunately, setting it in the constructor won't help, because EqualsVerifier bypasses it.
There are two ways you can make the EqualsVerifier test pass. Either you can add a null check in the equals method:
return this.getId() == null ? user.getId() == null : this.getId().equals(user.getId());
(Or simply use Objects.equals(this.getId(), user.getId()) )
Or, you can add a line to your call to EqualsVerifier:
.suppress(Warning.NULL_FIELDS)
.verify();
The first approach is correct if id is allowed to be null (because if something can be null, you have to check for it). The second approach is correct if id is never allowed to be null.
Good luck!
Jan