@Test void testLoginException() { // Expectation when(loginService.login(any(UserForm.class))) .thenThrow(IllegalArgumentException.class); // Exercise String response = loginController.login(userForm); // Verify assertEquals("ERROR", response); }
@Test void testLoginException() { // Expectation when(loginService.login(any(UserForm.class))) .thenThrow(IllegalArgumentException.class); // Exercise String response = loginController.login(userForm); // Verify assertEquals("ERROR", response); }
@Test void testLoginOk() { // Setting expectations (stubbing methods) when(loginService.login(userForm)).thenReturn(true); // Exercise SUT String reseponseLogin = loginController.login(userForm); // Verification assertEquals("OK", reseponseLogin); verify(loginService).login(userForm); verifyNoMoreInteractions(loginService); }
@Test void testLoginError() { // Exercise String response = loginController.login(null); // Verify assertEquals("ERROR", response); }
@Test void testLoginKo() { // Setting expectations (stubbing methods) when(loginService.login(userForm)).thenReturn(false); // Exercise SUT String reseponseLogin = loginController.login(userForm); // Verification assertEquals("KO", reseponseLogin); verify(loginService).login(userForm); verifyZeroInteractions(loginService); }
@Test void testLoginKo() { // Setting expectations (stubbing methods) when(loginService.login(userForm)).thenReturn(false); // Exercise SUT String reseponseLogin = loginController.login(userForm); // Verification assertEquals("KO", reseponseLogin); verify(loginService).login(userForm); verifyZeroInteractions(loginService); }
@Test void testLoginError() { // Exercise String response = loginController.login(null); // Verify assertEquals("ERROR", response); }
@Test void testLoginOk() { // Setting expectations (stubbing methods) when(loginService.login(userForm)).thenReturn(true); // Exercise SUT String reseponseLogin = loginController.login(userForm); // Verification assertEquals("OK", reseponseLogin); verify(loginService).login(userForm); verifyNoMoreInteractions(loginService); }
@Test void testLoginError() { assertEquals("ERROR", loginController.login(null)); }
@Test void testLoginError() { assertEquals("ERROR", loginController.login(null)); }
@Test void testLoginException() { given(loginService.login(any(UserForm.class))) .willThrow(IllegalArgumentException.class); assertEquals("ERROR", loginController.login(userForm)); }
@Test void testLoginException() { given(loginService.login(any(UserForm.class))) .willThrow(IllegalArgumentException.class); assertEquals("ERROR", loginController.login(userForm)); }
@Test void testLoginOk() { given(loginService.login(userForm)).willReturn(true); assertEquals("OK", loginController.login(userForm)); }
@Test void testLoginKo() { given(loginService.login(userForm)).willReturn(false); assertEquals("KO", loginController.login(userForm)); }
@Test void testLoginOk() { given(loginService.login(userForm)).willReturn(true); assertEquals("OK", loginController.login(userForm)); }
@Test void testLoginKo() { given(loginService.login(userForm)).willReturn(false); assertEquals("KO", loginController.login(userForm)); }