io.sphere.sdk.client.TestClient Maven / Gradle / Ivy
package io.sphere.sdk.client;
import io.sphere.sdk.models.Base;
import java.util.concurrent.ExecutionException;
public final class TestClient extends Base implements AutoCloseable {
private final SphereClient underlying;
public TestClient(final SphereClient underlying) {
this.underlying = underlying;
}
public T execute(final SphereRequest sphereRequest) {
try {
return underlying.execute(sphereRequest).toCompletableFuture().get();
} catch (final InterruptedException | ExecutionException e) {
throw (e.getCause() instanceof RuntimeException) ? ((RuntimeException) e.getCause()) : new TestClientException(e);
}
}
@Override
public void close() {
underlying.close();
}
public SphereClient getUnderlying() {
return underlying;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy