From 5c2ee4c55f0be96ccd6445a791232bb2934ed95a Mon Sep 17 00:00:00 2001 From: tommi27 Date: Fri, 22 May 2020 14:44:59 +0200 Subject: [PATCH] assertion error should be fixed --- .../smarthut/controller/GuestControllerTests.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/GuestControllerTests.java b/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/GuestControllerTests.java index 8619374..c116667 100644 --- a/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/GuestControllerTests.java +++ b/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/GuestControllerTests.java @@ -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)));