@Test public void itShouldCallOnResultWithNullIfAllSendersReturnedNullAndValidatorAndExceptionAreNotSpecified() throws ExecutionException, InterruptedException { RpcStrategy strategy1 = new RequestSenderOnResultWithNullStrategy(); RpcStrategy strategy2 = new RequestSenderOnResultWithNullStrategy(); RpcStrategy strategy3 = new RequestSenderOnResultWithNullStrategy(); RpcStrategyFirstValidResult firstValidResult = firstValidResult(strategy1, strategy2, strategy3); RpcSender sender = firstValidResult.createSender(new RpcClientConnectionPoolStub()); CompletableFuture<Object> future = new CompletableFuture<>(); sender.sendRequest(new Object(), 50, forFuture(future)); assertNull(future.get()); }
@Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.size() == 0) return null; return new Sender(senders, resultValidator, noValidResultException); }
RpcStrategyFirstValidResult implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.size() == 0) return null; return new Sender(senders, resultValidator, noValidResultException); } }
RpcStrategyFirstValidResult implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.size() == 0) return null; return new Sender(senders, resultValidator, noValidResultException); } private  RpcStrategyFirstValidResult(RpcStrategyList list, ResultValidator<?> resultValidator,
			@Nullable StacklessException noValidResultException); }
RpcStrategyFirstValidResult implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.size() == 0) return null; return new Sender(senders, resultValidator, noValidResultException); } private  RpcStrategyFirstValidResult(RpcStrategyList list, ResultValidator<?> resultValidator,
			@Nullable StacklessException noValidResultException); static RpcStrategyFirstValidResult create(RpcStrategyList list); RpcStrategyFirstValidResult withResultValidator(@NotNull ResultValidator<?> resultValidator); RpcStrategyFirstValidResult withNoValidResultException(@NotNull StacklessException e); @Override Set<InetSocketAddress> getAddresses(); @Nullable @Override RpcSender createSender(RpcClientConnectionPool pool); }
RpcStrategyFirstValidResult implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> senders = list.listOfSenders(pool); if (senders.size() == 0) return null; return new Sender(senders, resultValidator, noValidResultException); } private  RpcStrategyFirstValidResult(RpcStrategyList list, ResultValidator<?> resultValidator,
			@Nullable StacklessException noValidResultException); static RpcStrategyFirstValidResult create(RpcStrategyList list); RpcStrategyFirstValidResult withResultValidator(@NotNull ResultValidator<?> resultValidator); RpcStrategyFirstValidResult withNoValidResultException(@NotNull StacklessException e); @Override Set<InetSocketAddress> getAddresses(); @Nullable @Override RpcSender createSender(RpcClientConnectionPool pool);  }