diff --git a/http/rest-client/pom.xml b/http/rest-client/pom.xml index 0153a2024..b06e6b905 100644 --- a/http/rest-client/pom.xml +++ b/http/rest-client/pom.xml @@ -23,5 +23,9 @@ io.quarkus quarkus-rest-client-jsonb + + io.quarkus + quarkus-micrometer + diff --git a/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/ClientBookResourceIT.java b/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/ClientBookResourceIT.java index 89f36e6cb..62915efaa 100644 --- a/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/ClientBookResourceIT.java +++ b/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/ClientBookResourceIT.java @@ -8,29 +8,43 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; +import io.quarkus.test.services.QuarkusApplication; @QuarkusScenario public class ClientBookResourceIT { + @QuarkusApplication + static RestService app = new RestService(); + + @QuarkusApplication + static RestService appWithMicrometerDisabled = new RestService().withProperty("quarkus.micrometer.enabled", "false"); + @Test public void shouldGetBookFromRestClientXml() { - given().get("/client/book/xml").then().statusCode(HttpStatus.SC_OK) + app.given().get("/client/book/xml").then().statusCode(HttpStatus.SC_OK) .body(is( "Title in Xml")); } @Test public void shouldGetBookFromRestClientJson() { - given().get("/client/book/json").then().statusCode(HttpStatus.SC_OK) + app.given().get("/client/book/json").then().statusCode(HttpStatus.SC_OK) .body(is("{\"title\":\"Title in Json\"}")); } @Test @Tag("QUARKUS-1376") public void notFoundShouldNotReturnAnyResteasyImplementationDetails() { - String body = given().get("/notFound").then().statusCode(HttpStatus.SC_NOT_FOUND).extract().body().asString(); + String body = app.given().get("/notFound").then().statusCode(HttpStatus.SC_NOT_FOUND).extract().body().asString(); Assertions.assertFalse(body.contains("RESTEASY"), "Not found resource should not return any Resteasy implementation details, but was: " + body); } + + @Test + @Tag("QUARKUS-2127") + public void noNullPointerExceptionForRestClientUsageWithDisabledMicrometer() { + appWithMicrometerDisabled.given().get("/client/book/xml").then().statusCode(HttpStatus.SC_OK); + } }