EndpointIfAlreadyExists implements Fallback<URI>, InvocationContext<EndpointIfAlreadyExists> { @Override public ListenableFuture<URI> create(Throwable t) throws Exception { return immediateFuture(createOrPropagate(t)); }  @Override ListenableFuture<URI> create(Throwable t); @Override URI createOrPropagate(Throwable t); @Override EndpointIfAlreadyExists setContext(HttpRequest request);  }
@Test public void testFoundIsNullWhenEndpointNotSet() throws Exception { assertNull(getUnchecked(new EndpointIfAlreadyExists().create(new KeyAlreadyExistsException()))); }
@Test(expectedExceptions = RuntimeException.class) public void testNotFoundPropagates() throws Exception { new EndpointIfAlreadyExists().create(new RuntimeException()); }
@Test(expectedExceptions = NullPointerException.class) public void testNullIsBad() throws Exception { new EndpointIfAlreadyExists().create(null); }