Пример #1
0
 @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");
 }
Пример #2
0
 @Test
 public void NullServer_CheckConnection() {
   when(mockService.checkConnection(null)).thenReturn(ConnectionStatus.FAILURE);
   int result = msg.testConnection(null);
   assertEquals(1, result);
   verify(mockService).checkConnection(null);
 }
Пример #3
0
 @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");
 }