

package software.amazon.awssdk.services.defaultsmode;

import java.util.concurrent.CompletionException;
import software.amazon.awssdk.services.protocolrestjson.ProtocolRestJsonAsyncClient;
import software.amazon.awssdk.services.protocolrestjson.ProtocolRestJsonAsyncClientBuilder;
import software.amazon.awssdk.services.protocolrestjson.model.AllTypesResponse;

public class AsyncClientDefaultsModeTest
    extends ClientDefaultsModeTestSuite<ProtocolRestJsonAsyncClient, ProtocolRestJsonAsyncClientBuilder> {
    @Override
    protected ProtocolRestJsonAsyncClientBuilder newClientBuilder() {
        return ProtocolRestJsonAsyncClient.builder();
    }

    @Override
    protected AllTypesResponse callAllTypes(ProtocolRestJsonAsyncClient client) {
        try {
            return client.allTypes().join();
        } catch (CompletionException e) {
            if (e.getCause() instanceof RuntimeException) {
                throw (RuntimeException) e.getCause();
            }

            throw e;
        }
    }
}
