@@ -57,7 +57,7 @@ void parsePath() throws Exception {
5757 }
5858
5959 private void testParsePath (String path , Object ... expected ) throws Exception {
60- assertThat (getField (path , "{}" ).getParsedPath ()).containsExactly (expected );
60+ assertThat (getFieldOnDataResponse (path , "{}" ).getParsedPath ()).containsExactly (expected );
6161 }
6262
6363 @ Test
@@ -73,7 +73,7 @@ void parsePathInvalid() {
7373 }
7474
7575 private void testParseInvalidPath (String path ) {
76- assertThatIllegalArgumentException ().isThrownBy (() -> getField (path , "{}" )).withMessage ("Invalid path: '" + path + "'" );
76+ assertThatIllegalArgumentException ().isThrownBy (() -> getFieldOnDataResponse (path , "{}" )).withMessage ("Invalid path: '" + path + "'" );
7777 }
7878
7979 @ Test
@@ -87,14 +87,15 @@ void fieldValue() throws Exception {
8787 testFieldValue ("me" , "{}" , null ); // "data" not null but no such key
8888 testFieldValue ("me.friends" , "{\" me\" :{}}" , null );
8989 testFieldValue ("me.friends[0]" , "{\" me\" : {\" friends\" : []}}" , null );
90+ testFieldValue ("me.friends[0]" , "{\" me\" : {\" friends\" : []}}" , null );
9091
9192 // nest within map or list
9293 testFieldValue ("me.name" , "{\" me\" :{\" name\" :\" Luke\" }}" , "Luke" );
9394 testFieldValue ("me.friends[1].name" , "{\" me\" : {\" friends\" : [{\" name\" : \" Luke\" }, {\" name\" : \" Yoda\" }]}}" , "Yoda" );
9495 }
9596
9697 private void testFieldValue (String path , String dataJson , @ Nullable Object expected ) throws Exception {
97- Object value = getField (path , dataJson ).getValue ();
98+ Object value = getFieldOnDataResponse (path , dataJson ).getValue ();
9899 if (expected == null ) {
99100 assertThat (value ).isNull ();
100101 }
@@ -112,7 +113,7 @@ void fieldValueInvalidPath() {
112113 }
113114
114115 private void testFieldValueInvalidPath (String path , String json ) {
115- assertThatIllegalArgumentException ().isThrownBy (() -> getField (path , json ))
116+ assertThatIllegalArgumentException ().isThrownBy (() -> getFieldOnDataResponse (path , json ))
116117 .withMessageStartingWith ("Invalid path" );
117118 }
118119
@@ -126,7 +127,7 @@ void fieldErrors() {
126127 GraphQLError error2 = createError ("/me/friends" , "fail-me-friends" );
127128 GraphQLError error3 = createError ("/me/friends[0]/name" , "fail-me-friends-name" );
128129
129- ClientResponseField field = getField (path , error0 , error1 , error2 , error3 );
130+ ClientResponseField field = getFieldOnErrorResponse (path , error0 , error1 , error2 , error3 );
130131 List <ResponseError > errors = field .getErrors ();
131132
132133 assertThat (errors ).hasSize (3 );
@@ -143,13 +144,13 @@ private GraphQLError createError(@Nullable String errorPath, String message) {
143144 return builder .build ();
144145 }
145146
146- private ClientResponseField getField (String path , String dataJson ) throws Exception {
147+ private ClientResponseField getFieldOnDataResponse (String path , String dataJson ) throws Exception {
147148 Map <?, ?> dataMap = mapper .readValue (dataJson , Map .class );
148149 ClientGraphQlResponse response = creatResponse (Collections .singletonMap ("data" , dataMap ));
149150 return response .field (path );
150151 }
151152
152- private ClientResponseField getField (String path , GraphQLError ... errors ) {
153+ private ClientResponseField getFieldOnErrorResponse (String path , GraphQLError ... errors ) {
153154 List <?> list = Arrays .stream (errors ).map (GraphQLError ::toSpecification ).collect (Collectors .toList ());
154155 ClientGraphQlResponse response = creatResponse (Collections .singletonMap ("errors" , list ));
155156 return response .field (path );
0 commit comments