@Test public void listClusters_timeoutException_returnTimeoutException() throws Exception { expect(adminClient.describeCluster(anyObject())).andReturn(describeClusterResult); expect(describeClusterResult.clusterId()).andReturn(failedFuture(new TimeoutException())); expect(describeClusterResult.controller()).andReturn(failedFuture(new TimeoutException())); expect(describeClusterResult.nodes()).andReturn(failedFuture(new TimeoutException())); replay(adminClient, describeClusterResult); CompletableFuture<List<Cluster>> clusters = clusterManager.listClusters(); try { clusters.get(); fail(); } catch (ExecutionException e) { assertEquals(TimeoutException.class, e.getCause().getClass()); } }
@Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } @Inject  ClusterManagerImpl(Admin adminClient); }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } @Inject  ClusterManagerImpl(Admin adminClient); @Override CompletableFuture<List<Cluster>> listClusters(); @Override CompletableFuture<Optional<Cluster>> getCluster(String clusterId); @Override CompletableFuture<Cluster> getLocalCluster(); }
ClusterManagerImpl implements ClusterManager { @Override public CompletableFuture<List<Cluster>> listClusters() { return getLocalCluster().thenApply(cluster -> unmodifiableList(singletonList(cluster))); } @Inject  ClusterManagerImpl(Admin adminClient); @Override CompletableFuture<List<Cluster>> listClusters(); @Override CompletableFuture<Optional<Cluster>> getCluster(String clusterId); @Override CompletableFuture<Cluster> getLocalCluster();  }