@Test
public void shouldReturnServerForAGivenNetworkAddress() throws Exception {

  NetworkAddress networkAddress = NetworkAddress.builder()
      .ip("192.168.1.1")
      .port(9998)
      .build();
  NetworkAddressEntity networkAddressEntity = NetworkAddressEntity.builder()
      .ip("192.168.1.1")
      .port(9998)
      .build();
  ServerEntity serverEntity = getServerEntity();
  Server server = getServer();
  Observable<ServerEntity> observable = Observable.create(subscriber -> {
    subscriber.onNext(serverEntity);
    subscriber.onComplete();
  });
  when(mockNetworkAddressEntityDataMapper.transformInverse(networkAddress)).thenReturn(
      networkAddressEntity);
  when(mockServerSearchManager.searchServer(networkAddressEntity)).thenReturn(observable);
  when(mockServerEntityDataMapper.transform(serverEntity)).thenReturn(server);
  Observable<Server> serverObservable = networkActionProvider.searchServer(networkAddress);
  TestObserver<Server> testObserver = serverObservable.test();
  testObserver.assertNoErrors();
  testObserver.assertComplete();
  testObserver.assertResult(server);
  verify(mockServerSearchManager, times(1)).searchServer(networkAddressEntity);
  verify(mockServerEntityDataMapper, times(1)).transform(serverEntity);
  verifyNoMoreInteractions(mockServerSearchManager, mockServerEntityDataMapper);
}