Skip to content

Add mocking of HttpAsyncClient #12

@PawelAdamski

Description

@PawelAdamski

Currently HttpClientMock supports only mocking of HttpClient. In scope of this issue we want to add support for mocking HttpAsyncClient. Working HttpAsyncClientMock should look similar to HttpClientMock. Example:
Record:

HttpClientAsyncMock httpClientAsyncMock = new HttpClientAsyncMock();
httpClientAsyncMock .onGet("http://localhost/login")
  .withParameter("user","john")
  .doReturn("Ok");
httpClientAsyncMock .onPost("http://localhost/login").doReturnStatus(501);

verify:

httpClientAsyncMock .verify().get("http://localhost/login").withParameter("user","john").called()
httpClientAsyncMock .verify().post("http://localhost/login").notCalled()

HttpClientAsyncMock should have additional action to simulate a delay response.

httpClientAsyncMock .onPost("http://localhost/login").delay(4,TimeUnit.Seconds).doReturnStatus(501);

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions