Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
steniobhz committed Oct 22, 2024
1 parent ad49bda commit 8a2a7cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateleen-hook/README_hook.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Gateleen allows searching for listeners and routes using the query parameter `q`
Search for listeners based on a query parameter like this:

```
GET http://myserver:7012/gateleen/server/listenertest/_hooks/listeners?q=testQuery
GET http://myserver:7012/gateleen/server/listenertest/_hooks/listeners?q=test
```

The response will contain the matching listeners. If no match is found, an empty list is returned:
Expand All @@ -273,7 +273,7 @@ The response will contain the matching listeners. If no match is found, an empty
Similarly, you can search for routes using a query parameter:

```
GET http://myserver:7012/gateleen/server/listenertest/_hooks/routes?q=testRoute
GET http://myserver:7012/gateleen/server/routetest/_hooks/routes?q=test
```

The response contains the matching routes, or an empty list if no match is found.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ public void testRouteListing_NonMatchingQueryParam(TestContext context) {
Assert.assertFalse("Non-matching query param should not be found in response",
response.getBody().asString().contains(nonMatchingQueryParam));

// Send GET request with a matching query param
response = given().queryParam("q", queryParam)
.when().get(requestUrl)
.then().assertThat().statusCode(200)
.extract().response();

// Assert the response contain the matching query param
Assert.assertTrue("matching query param should be found in response",
response.getBody().asString().contains(queryParam));

// Unregister the route
removeRoute(queryParam);

Expand Down

0 comments on commit 8a2a7cf

Please sign in to comment.