Skip to content

Commit 2069889

Browse files
committed
tests
1 parent cd70bcc commit 2069889

File tree

3 files changed

+67
-3
lines changed

3 files changed

+67
-3
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.example.myapp.web.test;
2+
3+
import io.avaje.jsonb.Json;
4+
5+
public interface Outer1 {
6+
7+
@Json
8+
class State {
9+
10+
private String field;
11+
12+
public State() {}
13+
14+
public String getField() {
15+
return field;
16+
}
17+
18+
public void setField(String field) {
19+
this.field = field;
20+
}
21+
22+
public State(final String field) {
23+
this.field = field;
24+
}
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.example.myapp.web.test;
2+
3+
import io.avaje.jsonb.Json;
4+
5+
public interface Outer2 {
6+
7+
@Json
8+
class State {
9+
10+
private String field;
11+
12+
public State() {}
13+
14+
public String getField() {
15+
return field;
16+
}
17+
18+
public void setField(String field) {
19+
this.field = field;
20+
}
21+
22+
public State(final String field) {
23+
this.field = field;
24+
}
25+
}
26+
}

tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/test/TestController.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import io.avaje.http.api.Form;
99
import io.avaje.http.api.Get;
1010
import io.avaje.http.api.Header;
11+
import io.avaje.http.api.MatrixParam;
1112
import io.avaje.http.api.MediaType;
1213
import io.avaje.http.api.Path;
1314
import io.avaje.http.api.Post;
1415
import io.avaje.http.api.Produces;
1516
import io.avaje.http.api.Put;
16-
import io.avaje.http.api.MatrixParam;
1717
import io.javalin.http.Context;
1818

1919
@Path("test/")
@@ -107,7 +107,7 @@ String testForm(String name, String email, String url) {
107107
String testFormBean(MyForm form) {
108108
return form.name + "|" + form.email + "|" + form.url;
109109
}
110-
110+
111111
@Get("/withMatrixParam/{type-1;category;vendor-34}/{range;style}")
112112
void neo(
113113
@MatrixParam("type-1") String type,
@@ -116,6 +116,18 @@ void neo(
116116
String range,
117117
String style) {
118118

119-
System.out.println("Ever have that feeling where you're not sure if you're awake or dreaming?");
119+
System.out.println("Ever have that feeling where you're not sure if you're awake or dreaming?");
120+
}
121+
122+
@Post("/outer1/state")
123+
List<Outer1.State> testInnerClass(Outer1.State state) {
124+
125+
return List.of(state);
126+
}
127+
128+
@Get("/outer2/state")
129+
Outer2.State testInnerClass2() {
130+
131+
return new Outer2.State();
120132
}
121133
}

0 commit comments

Comments
 (0)