Callout Mock

An instance of forvendi.BreezzApi.CalloutMock class used for standardising HttpCalloutMocks for tests. Used standalone or in conjuction with forvendi.BreezzApi.CalloutMultiMock to setup multiple endpoints.


withBaseUrl(String url)

Appends a base URL to the URL supplied with forvendi.BreezzApi.CalloutMultiMock.addRoute(String url) method.

Signature:

forvendi.BreezzApi.CalloutMock.withBaseUrl(String url);

Parameters:

  • url - url address of tested endpoint.

Return Value:

CalloutMock - The mock itself for further configuration


withOrgBaseUrl()

Appends org base URL to the URL supplied with forvendi.BreezzApi.CalloutMultiMock.addRoute(String url) method.

Signature:

forvendi.BreezzApi.CalloutMock.withOrgBaseUrl();

Return Value:

CalloutMock - The mock itself for further configuration


withStatusCode(Integer statusCode)

Sets a status and a status code of HTTP response.

Signature:

forvendi.BreezzApi.CalloutMock.withStatusCode(Integer statusCode);

Parameters:

  • statusCode - an HTTP response status code.

Return Value:

CalloutMock - The mock itself for further configuration


withHeader(String name, String value)

Sets one of HTTP response headers.

Signature:

forvendi.BreezzApi.CalloutMock.withHeader(String name, String value);

Parameters:

  • name - name of header parameter
  • value - value of header parameter

Return Value:

CalloutMock - The mock itself for further configuration


withBody(String body)

Sets a body of HTTP response.

Signature:

forvendi.BreezzApi.CalloutMock.withBody(String body);

Parameters:

  • body - body of HTTP response

Return Value:

CalloutMock - The mock itself for further configuration


apply()

Registers a mock in its CalloutMultiMock parent.

Signature:

forvendi.BreezzApi.CalloutMock.apply();

Return Value:

CalloutMultiMock - Parent of the mock for adding additional mocks