1
1
/*
2
- * Copyright 2020-2022 the original author or authors.
2
+ * Copyright 2020-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .graphql .support ;
18
18
19
- import java .util .Collections ;
20
19
import java .util .Map ;
21
20
22
21
import org .junit .jupiter .api .Test ;
23
22
23
+ import org .springframework .graphql .GraphQlRequest ;
24
+
24
25
import static org .assertj .core .api .Assertions .assertThat ;
25
26
26
27
/**
@@ -31,19 +32,24 @@ class DefaultGraphQlRequestTests {
31
32
32
33
@ Test
33
34
void requestAsMapShouldContainAllEntries () {
35
+
34
36
String document = "query HeroNameAndFriends($episode: Episode) {" +
35
37
" hero(episode: $episode) {" +
36
38
" name"
37
39
+ " }" +
38
40
"}" ;
39
- Map <String , Object > variables = Collections .singletonMap ("episode" , "JEDI" );
40
- Map <String , Object > extensions = Collections .singletonMap ("myExtension" , "value" );
41
41
42
- DefaultExecutionGraphQlRequest request = new DefaultExecutionGraphQlRequest (document , "HeroNameAndFriends" ,
43
- variables , extensions , "1" , null );
42
+ Map <String , Object > variables = Map .of ("episode" , "JEDI" );
43
+ Map <String , Object > extensions = Map .of ("myExtension" , "value" );
44
+
45
+ GraphQlRequest request = new DefaultExecutionGraphQlRequest (
46
+ document , "HeroNameAndFriends" , variables , extensions , "1" , null );
44
47
45
- assertThat (request .toMap ()).containsEntry ("query" , document ).containsEntry ("operationName" , "HeroNameAndFriends" )
46
- .containsEntry ("variables" , variables ).containsEntry ("extensions" , extensions );
48
+ assertThat (request .toMap ())
49
+ .containsEntry ("query" , document )
50
+ .containsEntry ("operationName" , "HeroNameAndFriends" )
51
+ .containsEntry ("variables" , variables )
52
+ .containsEntry ("extensions" , extensions );
47
53
}
48
54
49
55
}
0 commit comments