All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.client.TestClient Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.client;

import java.util.concurrent.ExecutionException;

public final class TestClient {
    private final SphereClient underlying;

    public TestClient(final SphereClient underlying) {
        this.underlying = underlying;
    }

    public  T execute(final SphereRequest sphereRequest) {
        try {
            return underlying.execute(sphereRequest).get();
        } catch (final InterruptedException | ExecutionException e) {
            throw (e.getCause() instanceof RuntimeException) ? ((RuntimeException) e.getCause()) : new TestClientException(e);
        }
    }

    public void close() {
        underlying.close();
    }

    public SphereClient getUnderlying() {
        return underlying;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy