Skip to content

Commit

Permalink
Add coverage for HEAD request
Browse files Browse the repository at this point in the history
This is cover age for quarkusio/quarkus#43440
  • Loading branch information
jedla97 committed Nov 12, 2024
1 parent a4bea1a commit ebf2dda
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
package io.quarkus.ts.http.advanced.reactive;

import jakarta.enterprise.inject.spi.CDI;
import jakarta.ws.rs.Path;

public class GreetingResource extends GreetingAbstractResource {
@Override
public String hello() {
return "Hello from Quarkus REST";
}

@Path("/sub-resource")
public GreetingSubResources helloFromSubResource() {
return CDI.current()
.select(GreetingSubResources.class)
.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.quarkus.ts.http.advanced.reactive;

import jakarta.enterprise.context.RequestScoped;
import jakarta.ws.rs.GET;

@RequestScoped
public class GreetingSubResources {

@GET
public String get() {
return "Greeting from sub-resource";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,36 @@ public void abstractResourceWithPath() {
.body(is("Hello from Quarkus REST"));
}

@Test
@DisplayName("Test Quarkus REST using CDI getting the sub-resource")
void cdiSubResourceGetRequest() {
getApp().given()
.when().get(GREETING_ENDPOINT + "/sub-resource")
.then()
.statusCode(SC_OK)
.body(is("Greeting from sub-resource"));
}

@Test
@Tag("https://github.com/quarkusio/quarkus/pull/43440")
@DisplayName("Test Quarkus REST abstract resource with @Path using HEAD request")
void headRequestUsingAbstractResourceWithPath() {
getApp().given()
.when().head(GREETING_ENDPOINT)
.then()
.statusCode(SC_OK);
}

@Test
@Tag("https://github.com/quarkusio/quarkus/pull/43440")
@DisplayName("Test Quarkus REST using CDI getting the sub-resource using HEAD request")
void cdiSubResourceHeadRequest() {
getApp().given()
.when().head(GREETING_ENDPOINT + "/sub-resource")
.then()
.statusCode(SC_OK);
}

@Test
@DisplayName("GRPC Server test")
public void testGrpc() {
Expand Down

0 comments on commit ebf2dda

Please sign in to comment.