Class Matchers
java.lang.Object
org.keycloak.tests.utils.matchers.Matchers
Additional hamcrest matchers
- Author:
- hmlnarik
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.hamcrest.Matcher<jakarta.ws.rs.core.Response>Matcher on HTTP status code of aResponseinstance.static org.hamcrest.Matcher<org.apache.http.HttpResponse>Matcher on HTTP body of aResponseinstance.static <T> org.hamcrest.Matcher<jakarta.ws.rs.core.Response>Matches when the HTTP status code of aResponseinstance is equal to the given code.static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object>Matches when the type of a SAML object is instance ofAuthnRequestType.static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object>isSamlLogoutRequest(String destination) Matches when the destination of a SAMLLogoutRequestTypeinstance is equal to the given destination.static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object>isSamlResponse(org.keycloak.saml.common.constants.JBossSAMLURIConstants expectedStatus) Matches when the SAML status code of aResponseTypeinstance is equal to the given code.static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object>isSamlStatusResponse(org.keycloak.saml.common.constants.JBossSAMLURIConstants... expectedStatus) Matches when the SAML status of aStatusResponseTypeinstance is equal to the given code.static org.hamcrest.Matcher<jakarta.ws.rs.core.Response>statusCode(org.hamcrest.Matcher<? extends Number> matcher) Matcher on HTTP status code of aResponseinstance.static org.hamcrest.Matcher<org.apache.http.HttpResponse>statusCodeHC(org.hamcrest.Matcher<? extends Number> matcher) Matcher on HTTP status code of aResponseinstance (HttpClient variant).static org.hamcrest.Matcher<jakarta.ws.rs.core.Response>statusCodeIs(int expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code.static org.hamcrest.Matcher<jakarta.ws.rs.core.Response>statusCodeIs(jakarta.ws.rs.core.Response.Status expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code.static org.hamcrest.Matcher<org.apache.http.HttpResponse>statusCodeIsHC(int expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code (HttpClient variant).static org.hamcrest.Matcher<org.apache.http.HttpResponse>statusCodeIsHC(jakarta.ws.rs.core.Response.Status expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code (HttpClient variant).
-
Constructor Details
-
Matchers
public Matchers()
-
-
Method Details
-
body
public static org.hamcrest.Matcher<jakarta.ws.rs.core.Response> body(org.hamcrest.Matcher<String> matcher) Matcher on HTTP status code of aResponseinstance.- Parameters:
matcher-- Returns:
-
bodyHC
public static org.hamcrest.Matcher<org.apache.http.HttpResponse> bodyHC(org.hamcrest.Matcher<String> matcher) Matcher on HTTP body of aResponseinstance.- Parameters:
matcher-- Returns:
-
statusCode
public static org.hamcrest.Matcher<jakarta.ws.rs.core.Response> statusCode(org.hamcrest.Matcher<? extends Number> matcher) Matcher on HTTP status code of aResponseinstance.- Parameters:
matcher-- Returns:
-
statusCodeHC
public static org.hamcrest.Matcher<org.apache.http.HttpResponse> statusCodeHC(org.hamcrest.Matcher<? extends Number> matcher) Matcher on HTTP status code of aResponseinstance (HttpClient variant).- Parameters:
matcher-- Returns:
-
statusCodeIs
public static org.hamcrest.Matcher<jakarta.ws.rs.core.Response> statusCodeIs(jakarta.ws.rs.core.Response.Status expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code.- Parameters:
expectedStatusCode-- Returns:
-
statusCodeIsHC
public static org.hamcrest.Matcher<org.apache.http.HttpResponse> statusCodeIsHC(jakarta.ws.rs.core.Response.Status expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code (HttpClient variant).- Parameters:
expectedStatusCode-- Returns:
-
statusCodeIs
public static org.hamcrest.Matcher<jakarta.ws.rs.core.Response> statusCodeIs(int expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code.- Parameters:
expectedStatusCode-- Returns:
-
statusCodeIsHC
public static org.hamcrest.Matcher<org.apache.http.HttpResponse> statusCodeIsHC(int expectedStatusCode) Matches when the HTTP status code of aResponseinstance is equal to the given code (HttpClient variant).- Parameters:
expectedStatusCode-- Returns:
-
header
public static <T> org.hamcrest.Matcher<jakarta.ws.rs.core.Response> header(org.hamcrest.Matcher<Map<String, T>> matcher) Matches when the HTTP status code of aResponseinstance is equal to the given code.- Parameters:
matcher-- Returns:
-
isSamlResponse
public static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object> isSamlResponse(org.keycloak.saml.common.constants.JBossSAMLURIConstants expectedStatus) Matches when the SAML status code of aResponseTypeinstance is equal to the given code.- Parameters:
expectedStatus-- Returns:
-
isSamlLogoutRequest
public static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object> isSamlLogoutRequest(String destination) Matches when the destination of a SAMLLogoutRequestTypeinstance is equal to the given destination.- Parameters:
destination-- Returns:
-
isSamlAuthnRequest
public static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object> isSamlAuthnRequest()Matches when the type of a SAML object is instance ofAuthnRequestType.- Returns:
-
isSamlStatusResponse
public static <T> org.hamcrest.Matcher<org.keycloak.dom.saml.v2.SAML2Object> isSamlStatusResponse(org.keycloak.saml.common.constants.JBossSAMLURIConstants... expectedStatus) Matches when the SAML status of aStatusResponseTypeinstance is equal to the given code.- Parameters:
expectedStatus-- Returns:
-