Added test and some fixes
This commit is contained in:
parent
01ecd32868
commit
d2f2bb6ab0
|
@ -24,7 +24,7 @@ public class UserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/index")
|
@GetMapping("/index")
|
||||||
public String userList() {
|
public String showUserList(Model model) {
|
||||||
model.addAttribute("users", userRepository.findAll());
|
model.addAttribute("users", userRepository.findAll());
|
||||||
return "index";
|
return "index";
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,11 @@ public class UserControllerUnitTest {
|
||||||
userController = new UserController(mockedUserRepository);
|
userController = new UserController(mockedUserRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCalledIndex_thenCorrect() {
|
||||||
|
assertThat(userController.showUserList(mockedModel)).isEqualTo("index");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCalledshowSignUpForm_thenCorrect() {
|
public void whenCalledshowSignUpForm_thenCorrect() {
|
||||||
User user = new User("John", "john@domain.com");
|
User user = new User("John", "john@domain.com");
|
||||||
|
|
Loading…
Reference in New Issue