Exemplo n.º 1
0
 @Test
 public void testGetPidNotSupported() {
   SlaveServer mockSlave = mock(SlaveServer.class);
   AdvertiseAddress address = AdvertiseAddress.newPrivate();
   address.setStaticPort(1234);
   when(mockSlave.getPid()).thenThrow(new UnsupportedOperationException());
   SlaveXmlRpcEndpointImpl slave = new SlaveXmlRpcEndpointImpl(mockSlave);
   List<Object> response = slave.getPid("/foo");
   assertEquals(response.get(0), StatusCode.FAILURE.toInt());
 }
Exemplo n.º 2
0
 @Test
 public void testGetPid() {
   SlaveServer mockSlave = mock(SlaveServer.class);
   AdvertiseAddress address = AdvertiseAddress.newPrivate();
   address.setStaticPort(1234);
   when(mockSlave.getPid()).thenReturn(1234);
   SlaveXmlRpcEndpointImpl slave = new SlaveXmlRpcEndpointImpl(mockSlave);
   List<Object> response = slave.getPid("/foo");
   assertEquals(response.get(0), StatusCode.SUCCESS.toInt());
   assertEquals(response.get(2), 1234);
 }