Update UserDto and delete addVeganMealProperty
This commit is contained in:
@@ -14,7 +14,6 @@ import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class UserServiceTest {
|
||||
//logger that logs everything to the console
|
||||
private static Logger logger = LoggerFactory.getLogger(UserServiceTest.class);
|
||||
|
||||
@Mock
|
||||
@@ -26,8 +25,7 @@ public class UserServiceTest {
|
||||
|
||||
@Test
|
||||
public void userRegisterTest() throws Exception {
|
||||
//tests if registering works
|
||||
UserDto testUser = new UserDto(1L, "Eric", 0);
|
||||
UserDto testUser = new UserDto(1L, "Eric");
|
||||
Mockito.when(restTemplate.getForObject(new java.net.URI("http://localhost:8080/registerUser?name=Eric&password=password"),
|
||||
UserDto.class))
|
||||
.thenReturn(testUser);
|
||||
@@ -38,25 +36,13 @@ public class UserServiceTest {
|
||||
|
||||
@Test
|
||||
public void userLoginTest() throws Exception {
|
||||
//tests if logging in works
|
||||
UserDto testUser = new UserDto(1L, "Eric", 0);
|
||||
UserDto testUser = new UserDto(1L, "Eric");
|
||||
Mockito.when(restTemplate.getForObject(new java.net.URI("http://localhost:8080/loginUser?name=Eric&password=password"),
|
||||
UserDto.class))
|
||||
.thenReturn(testUser);
|
||||
UserDto user = userService.loginUser("Eric", "password");
|
||||
Assert.assertEquals(testUser, user);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addVeganMealTest() throws Exception {
|
||||
//tests if adding a vegetarian meal works
|
||||
UserDto testUser = new UserDto(1L, "Eric", 0);
|
||||
Mockito.when(restTemplate.getForObject(new java.net.URI("http://localhost:8080/addVeganMeal?id=1&name=Eric"),
|
||||
UserDto.class))
|
||||
.thenReturn(testUser);
|
||||
UserDto user = userService.addVeganMeal(1L, "Eric");
|
||||
Assert.assertEquals(testUser, user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user