Exemplo n.º 1
0
 @Test
 public void IncorrectServer_Send() throws MalformedRecipientException {
   when(mockService.send("xxx", "Message")).thenThrow(new MalformedRecipientException());
   int result = msg.sendMessage("xxx", "Message");
   assertEquals(2, result);
   verify(mockService).send("xxx", "Message");
 }
Exemplo n.º 2
0
 @Test
 public void CorrectServerAndMessage_SendingError() throws MalformedRecipientException {
   when(mockService.send("inf.ug.edu.pl", "Message")).thenReturn(SendingStatus.SENDING_ERROR);
   int result = msg.sendMessage("inf.ug.edu.pl", "Message");
   assertEquals(1, result);
   verify(mockService).send("inf.ug.edu.pl", "Message");
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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");
 }
Exemplo n.º 5
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");
 }
Exemplo n.º 6
0
 @Test
 public void NullServerAndMessage_Send() throws MalformedRecipientException {
   when(mockService.send(null, null)).thenThrow(new MalformedRecipientException());
   int result = msg.sendMessage(null, null);
   assertEquals(2, result);
   verify(mockService).send(null, null);
 }