Added test and some fixes

This commit is contained in:
Horacio Lopez 2020-11-17 21:57:15 -03:00
parent 01ecd32868
commit d2f2bb6ab0
2 changed files with 6 additions and 1 deletions

View File

@ -24,7 +24,7 @@ public class UserController {
}
@GetMapping("/index")
public String userList() {
public String showUserList(Model model) {
model.addAttribute("users", userRepository.findAll());
return "index";
}

View File

@ -28,6 +28,11 @@ public class UserControllerUnitTest {
userController = new UserController(mockedUserRepository);
}
@Test
public void whenCalledIndex_thenCorrect() {
assertThat(userController.showUserList(mockedModel)).isEqualTo("index");
}
@Test
public void whenCalledshowSignUpForm_thenCorrect() {
User user = new User("John", "john@domain.com");