@Test public void IncorrectServer_CheckConnection() { when(mockService.checkConnection("inf.ug.edu.com")).thenReturn(ConnectionStatus.FAILURE); int result = msg.testConnection("inf.ug.edu.com"); assertEquals(1, result); verify(mockService).checkConnection("inf.ug.edu.com"); }
@Test public void NullServer_CheckConnection() { when(mockService.checkConnection(null)).thenReturn(ConnectionStatus.FAILURE); int result = msg.testConnection(null); assertEquals(1, result); verify(mockService).checkConnection(null); }
@Test public void CorrectServer_CheckConnection() { when(mockService.checkConnection("inf.ug.edu.pl")).thenReturn(ConnectionStatus.SUCCESS); int result = msg.testConnection("inf.ug.edu.pl"); assertEquals(0, result); verify(mockService).checkConnection("inf.ug.edu.pl"); }