assertion error should be fixed
This commit is contained in:
parent
b1343bbd40
commit
5c2ee4c55f
1 changed files with 6 additions and 7 deletions
|
@ -50,16 +50,15 @@ public class GuestControllerTests {
|
||||||
User guest1 = new User();
|
User guest1 = new User();
|
||||||
User guest2 = new User();
|
User guest2 = new User();
|
||||||
|
|
||||||
|
user.addHost(host1);
|
||||||
|
user.addHost(host2);
|
||||||
|
user.addGuest(guest1);
|
||||||
|
user.addGuest(guest2);
|
||||||
|
|
||||||
when(mockPrincipal.getName()).thenReturn("user");
|
when(mockPrincipal.getName()).thenReturn("user");
|
||||||
when(userRepository.findByUsername(mockPrincipal.getName())).thenReturn(this.user);
|
when(userRepository.findByUsername(mockPrincipal.getName())).thenReturn(this.user);
|
||||||
when(userRepository.findAll()).thenReturn(List.of(host1, host2, guest1, guest2));
|
when(userRepository.findAll()).thenReturn(List.of(host1, host2, guest1, guest2));
|
||||||
assertThat(guestController.findAll())
|
assertThat(guestController.findAll()).isSameAs(List.of(host1, host2, guest1, guest2));
|
||||||
.isSameAs(
|
|
||||||
List.of(
|
|
||||||
UserResponse.fromUser(host1),
|
|
||||||
UserResponse.fromUser(host2),
|
|
||||||
UserResponse.fromUser(guest1),
|
|
||||||
UserResponse.fromUser(guest2)));
|
|
||||||
|
|
||||||
when(guestController.findHosts(mockPrincipal))
|
when(guestController.findHosts(mockPrincipal))
|
||||||
.thenReturn(List.of(UserResponse.fromUser(host1), UserResponse.fromUser(host2)));
|
.thenReturn(List.of(UserResponse.fromUser(host1), UserResponse.fromUser(host2)));
|
||||||
|
|
Loading…
Reference in a new issue