33import static com .github .m0nk3y2k4 .thetvdb .internal .resource .impl .LanguagesAPI .get ;
44import static com .github .m0nk3y2k4 .thetvdb .internal .resource .impl .LanguagesAPI .getAllAvailable ;
55import static com .github .m0nk3y2k4 .thetvdb .internal .util .http .HttpRequestMethod .GET ;
6- import static com .github .m0nk3y2k4 .thetvdb .testutils .MockServerUtil .json ;
6+ import static com .github .m0nk3y2k4 .thetvdb .testutils .MockServerUtil .jsonResponse ;
7+ import static com .github .m0nk3y2k4 .thetvdb .testutils .MockServerUtil .request ;
78import static com .github .m0nk3y2k4 .thetvdb .testutils .json .JSONTestUtil .JsonResource .LANGUAGE ;
89import static com .github .m0nk3y2k4 .thetvdb .testutils .json .JSONTestUtil .JsonResource .LANGUAGES ;
910import static com .github .m0nk3y2k4 .thetvdb .testutils .parameterized .TestRemoteAPICall .route ;
1011import static org .assertj .core .api .Assertions .assertThat ;
1112import static org .assertj .core .api .Assertions .assertThatIllegalArgumentException ;
12- import static org .mockserver .model .HttpRequest .request ;
13- import static org .mockserver .model .HttpResponse .response ;
13+ import static org .junit .jupiter .params .provider .Arguments .of ;
1414
1515import java .util .function .Supplier ;
1616import java .util .stream .Stream ;
@@ -31,26 +31,26 @@ class LanguagesAPITest {
3131
3232 @ BeforeAll
3333 static void setUpRoutes (MockServerClient client ) throws Exception {
34- client .when (request ("/languages" ). withMethod ( GET . getName ())) .respond (response (). withBody ( json ( LANGUAGES ) ));
35- client .when (request ("/languages/4584" ). withMethod ( GET . getName ())) .respond (response (). withBody ( json ( LANGUAGE ) ));
34+ client .when (request ("/languages" , GET )) .respond (jsonResponse ( LANGUAGES ));
35+ client .when (request ("/languages/4584" , GET )) .respond (jsonResponse ( LANGUAGE ));
3636 }
3737
3838 private static Stream <Arguments > withInvalidParameters () {
3939 return Stream .of (
40- Arguments . of (route (con -> get (con , 0 ), "get() with ZERO language ID" )),
41- Arguments . of (route (con -> get (con , -11 ), "get() with negative language ID" ))
40+ of (route (con -> get (con , 0 ), "get() with ZERO language ID" )),
41+ of (route (con -> get (con , -11 ), "get() with negative language ID" ))
4242 );
4343 }
4444
4545 @ SuppressWarnings ("Convert2MethodRef" )
4646 private static Stream <Arguments > withValidParameters () {
4747 return Stream .of (
48- Arguments . of (route (con -> get (con , 4584 ), "get()" ), LANGUAGE ),
49- Arguments . of (route (con -> getAllAvailable (con ), "getAllAvailable()" ), LANGUAGES )
48+ of (route (con -> get (con , 4584 ), "get()" ), LANGUAGE ),
49+ of (route (con -> getAllAvailable (con ), "getAllAvailable()" ), LANGUAGES )
5050 );
5151 }
5252
53- @ ParameterizedTest (name = "[{index}] Route LanguagesAPI.{0} rejected" )
53+ @ ParameterizedTest (name = "[{index}] Route LanguagesAPI.{0} invalid parameters rejected" )
5454 @ MethodSource (value = "withInvalidParameters" )
5555 void invokeRoute_withInvalidParameters_verifyParameterValidation (TestRemoteAPICall route , Supplier <RemoteAPI > remoteAPI ) {
5656 assertThatIllegalArgumentException ().isThrownBy (() -> route .invoke (new APIConnection ("946FG8I5P5E56E4" , remoteAPI )));
0 commit comments