Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.it.spring.web;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand Down Expand Up @@ -39,4 +40,9 @@ public Greeting greetingWithIllegalArgumentException() {
throw new IllegalArgumentException("hello from error");
}

@GetMapping("/re")
public ResponseEntity<Greeting> responseEntityWithIllegalArgumentException() {
throw new IllegalStateException("hello from error");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,12 @@ public void testRestControllerWithoutRequestMapping() {
RestAssured.when().get("/hello").then()
.body(containsString("hello"));
}

@Test
public void testResponseEntityWithIllegalArgumentException() {
RestAssured.when().get("/exception/re").then()
.contentType("application/json")
.body(containsString("hello from error"))
.statusCode(402);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, where does this status code come from? 402 seems pretty unusual, but maybe it's completely normal in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a random one to make ensure the response was different

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could have been anything, I just picked one in random 🤪

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP!

}
}