-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Remove URI validation when `@TestHTTPResource` is injected as String
- Loading branch information
Showing
6 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...va/io/quarkus/resteasy/reactive/server/test/StringTestHTTPResourceWithPathParamsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.quarkus.resteasy.reactive.server.test; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.PathParam; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.quarkus.test.common.http.TestHTTPEndpoint; | ||
import io.quarkus.test.common.http.TestHTTPResource; | ||
|
||
public class StringTestHTTPResourceWithPathParamsTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest().withApplicationRoot((jar) -> jar.addClass(UserResource.class)); | ||
|
||
@TestHTTPEndpoint(UserResource.class) | ||
@TestHTTPResource("{userId}/order/{orderId}") | ||
String getUserOrderUrl; | ||
|
||
@Test | ||
void testGettingUserOrder() { | ||
int userId = 123; | ||
int orderId = 456; | ||
given().when().get(getUserOrderUrl, userId, orderId) | ||
.then().statusCode(200).body(equalTo(String.format("Order (%d) of user (%d)", userId, orderId))); | ||
} | ||
|
||
@Path("/user") | ||
public static class UserResource { | ||
@Path("{userId}/order/{orderId}") | ||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String getUserOrder(@PathParam("userId") int userId, @PathParam("orderId") int orderId) { | ||
return String.format("Order (%d) of user (%d)", userId, orderId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters