File tree Expand file tree Collapse file tree 3 files changed +48
-5
lines changed
examples/example-javalin/src
java/org/example/myapp/web
test/java/org/example/myapp Expand file tree Collapse file tree 3 files changed +48
-5
lines changed Original file line number Diff line number Diff line change 1717import java .time .LocalDate ;
1818import java .util .ArrayList ;
1919import java .util .List ;
20+ import java .util .Objects ;
2021
22+ import static java .util .Objects .nonNull ;
23+ import static java .util .Objects .requireNonNull ;
2124import static org .example .myapp .web .AppRoles .ADMIN ;
2225
2326/**
@@ -38,6 +41,12 @@ class HelloController {
3841 this .myService = myService ;
3942 }
4043
44+ @ Produces (MediaType .TEXT_PLAIN )
45+ @ Get ("message" )
46+ String getPlainMessage () {
47+ return "hello world" ;
48+ }
49+
4150 /**
4251 * Return the Hello DTO.
4352 *
@@ -85,6 +94,9 @@ HelloDto post(HelloDto dto) {
8594 void saveBean (String foo , HelloDto dto , Context context ) {
8695 // save hello data ...
8796 System .out .println ("save " + foo + " dto:" + dto );
97+ requireNonNull (foo );
98+ requireNonNull (dto );
99+ requireNonNull (context );
88100 }
89101
90102 /**
@@ -121,9 +133,4 @@ void deleteById(int id) {
121133 System .out .println ("deleting " + id );
122134 }
123135
124- @ Produces (MediaType .TEXT_PLAIN )
125- @ Get ("message" )
126- String getPlainMessage () {
127- return "hello world" ;
128- }
129136}
Original file line number Diff line number Diff line change 365365 }
366366 }
367367 },
368+ "/hello/saveform3" : {
369+ "post" : {
370+ "tags" : [ ],
371+ "summary" : " " ,
372+ "description" : " " ,
373+ "requestBody" : {
374+ "content" : {
375+ "application/x-www-form-urlencoded" : {
376+ "schema" : {
377+ "$ref" : " #/components/schemas/HelloForm"
378+ }
379+ }
380+ },
381+ "required" : true
382+ },
383+ "responses" : {
384+ "201" : {
385+ "description" : " " ,
386+ "content" : {
387+ "application/json" : {
388+ "schema" : {
389+ "$ref" : " #/components/schemas/HelloDto"
390+ }
391+ }
392+ }
393+ }
394+ }
395+ }
396+ },
368397 "/hello/{id}" : {
369398 "delete" : {
370399 "tags" : [ ],
Original file line number Diff line number Diff line change @@ -93,4 +93,11 @@ void postForm3_controllerFormBean_responseJsonDto() {
9393 .body ("id" , equalTo (52 ))
9494 .statusCode (201 );
9595 }
96+
97+ @ Test
98+ void delete () {
99+ given ().delete (baseUrl + "/hello/52" )
100+ .then ()
101+ .statusCode (204 );
102+ }
96103}
You can’t perform that action at this time.
0 commit comments