Our test class is composed of two blocks. In the first block, we retrieve a token for the test user and the admin user. Then, we use both tokens to test the application. More specifically, the test token, which belongs to the user role, will be used for GET requests. On the other hand, the admin token will be used to authorize POST, PUT, and DELETE requests.
Here is the first block of the test class:
@ConfigProperty(name = "keycloak.url")String keycloakURL; @Test public void testHelloEndpoint() { RestAssured.baseURI = keycloakURL; Response response = given().urlEncodingEnabled(true) .auth().preemptive().basic("quarkus-client", "mysecret") .param("grant_type", "password") .param("client_id", "quarkus-client") .param("username", ...