共用方式為


AssertingHttpClientBuilder Class

  • java.lang.Object
    • com.azure.core.test.http.AssertingHttpClientBuilder

public class AssertingHttpClientBuilder

HTTP client builder that helps in running sync and async assertion checks.

Constructor Summary

Constructor Description
AssertingHttpClientBuilder(HttpClient delegate)

Create an instance of AssertingHttpClientBuilder with the provided HttpClient.

Method Summary

Modifier and Type Method and Description
AssertingHttpClientBuilder assertAsync()

Asserts that only async implementations are invoked from within the implementation call stack.

AssertingHttpClientBuilder assertSync()

Asserts that only sync implementations are invoked from within the implementation call stack.

HttpClient build()

Creates a new HttpClient instance that helps in providing assertions for invoking http client implementations.

AssertingHttpClientBuilder skipRequest(BiFunction<HttpRequest,Context,Boolean> skipRequestFunction)

Method used to specify http requests to be skipped when executing assertions.

Methods inherited from java.lang.Object

Constructor Details

AssertingHttpClientBuilder

public AssertingHttpClientBuilder(HttpClient delegate)

Create an instance of AssertingHttpClientBuilder with the provided HttpClient.

Parameters:

delegate - the HttpClient.

Method Details

assertAsync

public AssertingHttpClientBuilder assertAsync()

Asserts that only async implementations are invoked from within the implementation call stack. Cause tests to fail if sync HttpClient#sendSync(HttpRequest, Context) is invoked.

Returns:

the AssertingHttpClientBuilder itself.

assertSync

public AssertingHttpClientBuilder assertSync()

Asserts that only sync implementations are invoked from within the implementation call stack. Cause tests to fail if async or HttpClient#send(HttpRequest, Context) invoked.

Returns:

the AssertingHttpClientBuilder itself.

build

public HttpClient build()

Creates a new HttpClient instance that helps in providing assertions for invoking http client implementations.

Returns:

A new AssertingClient instance.

skipRequest

public AssertingHttpClientBuilder skipRequest(BiFunction skipRequestFunction)

Method used to specify http requests to be skipped when executing assertions.

Parameters:

skipRequestFunction - the function used to specify http requests to be skipped for sync assertions.

Returns:

the AssertingHttpClientBuilder itself.

Applies to