assertion error should be fixed

This commit is contained in:
Tommaso Rodolfo Masera 2020-05-22 14:44:59 +02:00
parent b1343bbd40
commit 5c2ee4c55f

View file

@ -50,16 +50,15 @@ public class GuestControllerTests {
User guest1 = new User();
User guest2 = new User();
user.addHost(host1);
user.addHost(host2);
user.addGuest(guest1);
user.addGuest(guest2);
when(mockPrincipal.getName()).thenReturn("user");
when(userRepository.findByUsername(mockPrincipal.getName())).thenReturn(this.user);
when(userRepository.findAll()).thenReturn(List.of(host1, host2, guest1, guest2));
assertThat(guestController.findAll())
.isSameAs(
List.of(
UserResponse.fromUser(host1),
UserResponse.fromUser(host2),
UserResponse.fromUser(guest1),
UserResponse.fromUser(guest2)));
assertThat(guestController.findAll()).isSameAs(List.of(host1, host2, guest1, guest2));
when(guestController.findHosts(mockPrincipal))
.thenReturn(List.of(UserResponse.fromUser(host1), UserResponse.fromUser(host2)));