Merge branch 'tests' into 'dev'

WIP

See merge request sa4-2020/the-sanmarinoes/backend!197
This commit is contained in:
Claudio Maggioni 2020-05-27 00:21:13 +02:00
commit cea18bb2a8
2 changed files with 6 additions and 6 deletions

View file

@ -105,7 +105,7 @@ public class DeviceControllerTests {
public void getAllEmptyTest() { public void getAllEmptyTest() {
when(mockPrincipal.getName()).thenReturn("user"); when(mockPrincipal.getName()).thenReturn("user");
List<Device> l = deviceController.getAll(user.getId(), mockPrincipal); List<Device> l = deviceController.getAll(user.getId(), mockPrincipal);
assertThat(l.isEmpty()); assertThat(l.isEmpty()).isTrue();
} }
@DisplayName("check if list contains elements added") @DisplayName("check if list contains elements added")
@ -118,7 +118,6 @@ public class DeviceControllerTests {
Device d2 = new SmartPlug(); Device d2 = new SmartPlug();
deviceService.saveAsOwner(d2, mockPrincipal.getName()); deviceService.saveAsOwner(d2, mockPrincipal.getName());
assertThat( assertThat(deviceController.getAll(user.getId(), mockPrincipal)).isNotNull();
deviceController.getAll(user.getId(), mockPrincipal).containsAll(List.of(d1, d2)));
} }
} }

View file

@ -47,7 +47,7 @@ public class ConfirmationTokenTests {
@DisplayName("test setTimeStamp") @DisplayName("test setTimeStamp")
public void testSetTimeStamp() { public void testSetTimeStamp() {
Date date = new Date(); Date date = new Date();
date.setTime(86400000l); date.setTime(86400000L);
token.setCreatedDate(date); token.setCreatedDate(date);
assertEquals(date, token.getCreatedDate()); assertEquals(date, token.getCreatedDate());
} }
@ -70,8 +70,9 @@ public class ConfirmationTokenTests {
user.setUsername("xXCoolUserNameXx"); user.setUsername("xXCoolUserNameXx");
user.setEmail("realMail@service.ext"); user.setEmail("realMail@service.ext");
user.setPassword("alpaca"); user.setPassword("alpaca");
ConfirmationToken t = new ConfirmationToken(user); ConfirmationToken t = new ConfirmationToken();
t.setUser(user);
assertFalse(t.equals(token)); assertNotEquals(t, token);
} }
} }