CustomMatcher Class

public class CustomMatcher
extends TestProxyRequestMatcher

This matcher exposes the default matcher in a customizable way. Currently, this includes ignoring/excluding headers, comparing request bodies and ignoring query params or query params ordering.

Constructor Summary

Constructor Description
CustomMatcher()

Creates an instance of CustomMatcher

Method Summary

Modifier and Type Method and Description
List<String> getExcludedHeaders()

Gets the list of headers that should be excluded during matching.

List<String> getHeadersKeyOnlyMatch()

Gets the list of headers that should be ignored during matching.

List<String> getIgnoredQueryParameters()

Gets the list of query parameters that should be ignored during matching.

boolean isComparingBodies()

Get the comparing bodies boolean.

boolean isQueryOrderingIgnored()

Get the boolean value to sort query params alphabetically before comparing URIs when matching

CustomMatcher setComparingBodies(boolean comparingBodies)

Sets true to enable body matching (default behavior), or false to disable body matching.

CustomMatcher setExcludedHeaders(List<String> excludedHeaders)

Sets the list of headers that should be excluded during matching.

CustomMatcher setHeadersKeyOnlyMatch(List<String> headersKeyOnlyMatch)

Sets the list of headers that should be ignored during matching.

CustomMatcher setIgnoredQueryParameters(List<String> ignoredQueryParameters)

Sets the list of query parameters that should be ignored during matching.

CustomMatcher setQueryOrderingIgnored(boolean queryOrderingIgnored)

Sets query ordering to a boolean value to sort query params alphabetically before comparing URIs when matching.

Methods inherited from TestProxyRequestMatcher

Methods inherited from java.lang.Object

Constructor Details

CustomMatcher

public CustomMatcher()

Creates an instance of CustomMatcher

Method Details

getExcludedHeaders

public List getExcludedHeaders()

Gets the list of headers that should be excluded during matching. The presence of these headers will not be taken into account while matching.

Returns:

the excluded headers list

getHeadersKeyOnlyMatch

public List getHeadersKeyOnlyMatch()

Gets the list of headers that should be ignored during matching. The header values won't be matched, but the presence of these headers will be taken into account while matching.

Returns:

the ignored headers list

getIgnoredQueryParameters

public List getIgnoredQueryParameters()

Gets the list of query parameters that should be ignored during matching. The parameter values won't be matched, but the presence of these parameters will be taken into account.

Returns:

the ignored query parameters

isComparingBodies

public boolean isComparingBodies()

Get the comparing bodies boolean. True to enable body matching (default behavior), or false to disable body matching.

Returns:

the boolean

isQueryOrderingIgnored

public boolean isQueryOrderingIgnored()

Get the boolean value to sort query params alphabetically before comparing URIs when matching

Returns:

the boolean

setComparingBodies

public CustomMatcher setComparingBodies(boolean comparingBodies)

Sets true to enable body matching (default behavior), or false to disable body matching.

Parameters:

comparingBodies - the compare bodies

Returns:

The updated CustomMatcher object.

setExcludedHeaders

public CustomMatcher setExcludedHeaders(List excludedHeaders)

Sets the list of headers that should be excluded during matching. The presence of these headers will not be taken into account while matching.

Parameters:

excludedHeaders - the list of excluded headers

Returns:

The updated CustomMatcher object.

setHeadersKeyOnlyMatch

public CustomMatcher setHeadersKeyOnlyMatch(List headersKeyOnlyMatch)

Sets the list of headers that should be ignored during matching. The header values won't be matched, but the presence of these headers will be taken into account while matching.

Parameters:

headersKeyOnlyMatch - the ignored headers list

Returns:

The updated CustomMatcher object.

setIgnoredQueryParameters

public CustomMatcher setIgnoredQueryParameters(List ignoredQueryParameters)

Sets the list of query parameters that should be ignored during matching. The parameter values won't be matched, but the presence of these parameters will be taken into account.

Parameters:

ignoredQueryParameters - the ignored query parameters

Returns:

The updated CustomMatcher object.

setQueryOrderingIgnored

public CustomMatcher setQueryOrderingIgnored(boolean queryOrderingIgnored)

Sets query ordering to a boolean value to sort query params alphabetically before comparing URIs when matching.

Parameters:

queryOrderingIgnored - to ignore query ordering boolean value

Returns:

The updated CustomMatcher object.

Applies to