File tree Expand file tree Collapse file tree
coverage-report/src/test/java/org/jooby/issues Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .jooby .issues ;
2+
3+ import java .util .Optional ;
4+
5+ import org .jooby .Parser ;
6+ import org .jooby .test .ServerFeature ;
7+ import org .junit .Test ;
8+
9+ public class Issue483 extends ServerFeature {
10+
11+ public static class NullableBean {
12+
13+ String foo ;
14+
15+ Optional <String > bar ;
16+
17+ @ Override
18+ public String toString () {
19+ return foo + bar ;
20+ }
21+ }
22+
23+ {
24+ parser (Parser .bean (true ));
25+
26+ get ("/483" , req -> {
27+ return req .params (NullableBean .class ).toString ();
28+ });
29+
30+ }
31+
32+ @ Test
33+ public void documentNullBeanInjection () throws Exception {
34+ request ()
35+ .get ("/483?foo=foo" )
36+ .expect ("foonull" );
37+
38+ request ()
39+ .get ("/483?foo=foo&bar" )
40+ .expect ("fooOptional[]" );
41+
42+ request ()
43+ .get ("/483?foo=foo&bar=bar" )
44+ .expect ("fooOptional[bar]" );
45+ }
46+
47+ }
You can’t perform that action at this time.
0 commit comments