File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
modules/jooby-test/src/main/java/io/jooby/test
tests/src/test/java/io/jooby/i3787 Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1818import io .jooby .Router ;
1919import io .jooby .SneakyThrows ;
2020import io .jooby .WebSocket ;
21+ import io .jooby .problem .ProblemDetailsHandler ;
2122
2223/**
2324 * Utility class that allows us to execute routes using a {@link MockContext}.
@@ -74,6 +75,9 @@ public Object value() {
7475 * @param application Source application.
7576 */
7677 public MockRouter (@ NonNull Jooby application ) {
78+ if (application .problemDetailsIsEnabled ()) {
79+ application .error (ProblemDetailsHandler .from (application .getConfig ()));
80+ }
7781 this .supplier = () -> application ;
7882 }
7983
Original file line number Diff line number Diff line change 11package io .jooby .i3787 ;
22
3+ import com .typesafe .config .Config ;
4+ import com .typesafe .config .ConfigFactory ;
35import io .jooby .Jooby ;
46import io .jooby .problem .HttpProblem ;
57
8+ import java .util .Map ;
9+
610class Application extends Jooby {
711 {
12+ Config problemDetailsConfig = ConfigFactory .parseMap (
13+ Map .of ("problem.details.enabled" , true )
14+ );
15+ getEnvironment ().setConfig (problemDetailsConfig .withFallback (getConfig ()));
16+
817 get ("/throw" , ctx -> {
918 throw new CustomException ();
1019 });
@@ -19,5 +28,6 @@ public static void main(String[] args) {
1928 runApp (args , Application ::new );
2029 }
2130
22- static class CustomException extends RuntimeException {}
31+ static class CustomException extends RuntimeException {
32+ }
2333}
You can’t perform that action at this time.
0 commit comments