Copilot commented on code in PR #29715:
URL: https://github.com/apache/flink/pull/29715#discussion_r4590211513
##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/application/ApplicationDetailsHandlerTest.java:
##########
@@ -100,4 +106,19 @@ void testGetApplicationDetails() throws Exception {
assertThat(detailsInfo)
.isEqualTo(ApplicationDetailsInfo.fromArchivedApplication(archivedApplication));
}
+
+ @Test
+ void testUnknownApplicationRespondsWithNotFound() {
+ final TestingRestfulGateway gateway =
+ new TestingRestfulGateway.Builder()
+ .setRequestApplicationFunction(
+ applicationId ->
+ FutureUtils.completedExceptionally(
+ new
FlinkApplicationNotFoundException(
+ applicationId)))
+ .build();
+
+ assertThat(handler.handleRequest(handlerRequest, gateway))
+
.satisfies(matching(RestMatchers.respondsWithError(HttpResponseStatus.NOT_FOUND)));
Review Comment:
This new assertion uses Hamcrest through `RestMatchers` and
`HamcrestCondition.matching`, contrary to the requirement to use native AssertJ
assertions in new tests. Assert the failed future's `RestHandlerException` and
HTTP status directly with AssertJ, and remove the Hamcrest-based imports. Same
issue in
`flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/application/ApplicationExceptionsHandlerTest.java:141–142`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]