9
9
import java .util .Map ;
10
10
11
11
import static org .assertj .core .api .Assertions .assertThat ;
12
- import static org .junit .jupiter .api .Assertions .assertEquals ;
13
- import static org .junit .jupiter .api .Assertions .assertNotNull ;
14
- import static org .junit .jupiter .api .Assertions .fail ;
12
+ import static org .junit .jupiter .api .Assertions .*;
15
13
16
14
class HelloControllerTest extends BaseWebTest {
17
15
@@ -22,7 +20,7 @@ void get_helloMessage() {
22
20
23
21
final HttpResponse <String > hres = clientContext .request ()
24
22
.path ("hello" ).path ("message" )
25
- .get ().asString ();
23
+ .GET ().asString ();
26
24
27
25
assertThat (hres .body ()).contains ("hello world" );
28
26
assertThat (hres .statusCode ()).isEqualTo (200 );
@@ -34,7 +32,7 @@ void get_helloMessage_via_url() {
34
32
final HttpResponse <String > hres = clientContext .request ()
35
33
.url ("http://127.0.0.1:8887" )
36
34
.path ("hello" ).path ("message" )
37
- .get ().asString ();
35
+ .GET ().asString ();
38
36
39
37
assertThat (hres .body ()).contains ("hello world" );
40
38
assertThat (hres .statusCode ()).isEqualTo (200 );
@@ -45,7 +43,7 @@ void get_hello_returningListOfBeans() {
45
43
46
44
final List <HelloDto > helloDtos = clientContext .request ()
47
45
.path ("hello" )
48
- .get ().list (HelloDto .class );
46
+ .GET ().list (HelloDto .class );
49
47
50
48
assertThat (helloDtos ).hasSize (2 );
51
49
}
@@ -54,8 +52,9 @@ void get_hello_returningListOfBeans() {
54
52
void get_withPathParamAndQueryParam_returningBean () {
55
53
56
54
final HelloDto dto = clientContext .request ()
57
- .path ("hello/43/2020-03-05" ).queryParam ("otherParam" , "other" ).queryParam ("foo" , (String ) null )
58
- .get ().bean (HelloDto .class );
55
+ .path ("hello/43/2020-03-05" ).queryParam ("otherParam" , "other" ).queryParam ("foo" , null )
56
+ .GET ()
57
+ .bean (HelloDto .class );
59
58
60
59
assertThat (dto .id ).isEqualTo (43L );
61
60
assertThat (dto .name ).isEqualTo ("2020-03-05" );
@@ -73,7 +72,7 @@ void post_bean_returningBean_usingExplicitConverters() {
73
72
final HelloDto bean = clientContext .request ()
74
73
.path ("hello" )
75
74
.body (from .write (dto ))
76
- .post ()
75
+ .POST ()
77
76
.read (toDto );
78
77
79
78
assertEquals ("posted" , bean .name );
@@ -87,7 +86,8 @@ void post_bean_returningVoid() {
87
86
88
87
final HttpResponse <Void > res = clientContext .request ()
89
88
.path ("hello/savebean/foo" )
90
- .body (dto ).post ()
89
+ .body (dto )
90
+ .POST ()
91
91
.asDiscarding ();
92
92
93
93
assertThat (res .statusCode ()).isEqualTo (201 );
@@ -102,7 +102,7 @@ void postForm() {
102
102
.formParam ("email" , "user@foo.com" )
103
103
.formParam ("url" , "http://foo.com" )
104
104
.formParam ("startDate" , "2030-12-03" )
105
- .post ()
105
+ .POST ()
106
106
.asDiscarding ();
107
107
108
108
assertThat (res .statusCode ()).isEqualTo (201 );
@@ -117,7 +117,7 @@ void postForm_returningBean() {
117
117
.formParam ("email" , "user@foo.com" )
118
118
.formParam ("url" , "http://foo.com" )
119
119
.formParam ("startDate" , "2030-12-03" )
120
- .post ()
120
+ .POST ()
121
121
.asDiscarding ();
122
122
123
123
assertThat (res .statusCode ()).isEqualTo (201 );
@@ -128,7 +128,7 @@ void postForm_returningBean() {
128
128
.formParam ("email" , "Bax@foo.com" )
129
129
.formParam ("url" , "http://foo.com" )
130
130
.formParam ("startDate" , "2030-12-03" )
131
- .post ()
131
+ .POST ()
132
132
.bean (HelloDto .class );
133
133
134
134
assertThat (bean .name ).isEqualTo ("Bax" );
@@ -143,7 +143,7 @@ void postForm_asVoid_validResponse() {
143
143
.formParam ("name" , "baz" )
144
144
.formParam ("email" , "user@foo.com" )
145
145
.formParam ("url" , "http://foo" )
146
- .post ()
146
+ .POST ()
147
147
.asVoid ();
148
148
149
149
assertEquals (201 , res .statusCode ());
@@ -156,7 +156,7 @@ void postForm_asVoid_invokesValidation_expect_badRequest_extractError() {
156
156
.path ("hello/saveform" )
157
157
.formParam ("email" , "user@foo.com" )
158
158
.formParam ("url" , "notAValidUrl" )
159
- .post ()
159
+ .POST ()
160
160
.asVoid ();
161
161
162
162
fail ();
@@ -183,7 +183,7 @@ void postForm_asBytes_validation_expect_badRequest_extractError() {
183
183
.path ("hello/saveform" )
184
184
.formParam ("email" , "user@foo.com" )
185
185
.formParam ("url" , "notAValidUrl" )
186
- .post ().asVoid ();
186
+ .POST ().asVoid ();
187
187
188
188
fail ();
189
189
@@ -212,7 +212,8 @@ void delete() {
212
212
final HttpResponse <Void > res =
213
213
clientContext .request ()
214
214
.path ("hello/52" )
215
- .delete ().asDiscarding ();
215
+ .DELETE ()
216
+ .asDiscarding ();
216
217
217
218
assertThat (res .statusCode ()).isEqualTo (204 );
218
219
}
@@ -226,7 +227,8 @@ void get_withMatrixParam() {
226
227
.matrixParam ("country" , "nz" )
227
228
.path ("foo" )
228
229
.queryParam ("extra" , "banana" )
229
- .get ().asString ();
230
+ .GET ()
231
+ .asString ();
230
232
231
233
assertEquals (200 , httpRes .statusCode ());
232
234
assertEquals ("yr:2011 au:rob co:nz other:foo extra:banana" , httpRes .body ());
0 commit comments