@@ -45,14 +45,13 @@ class GraphQlArgumentBinderTests {
45
45
46
46
private final ObjectMapper mapper = new ObjectMapper ();
47
47
48
- private final ThreadLocal <GraphQlArgumentBinder > initializer =
49
- ThreadLocal .withInitial (() -> new GraphQlArgumentBinder (null ));
48
+ private final GraphQlArgumentBinder binder = new GraphQlArgumentBinder (null );
50
49
51
50
52
51
@ Test
53
52
void defaultConstructor () throws Exception {
54
53
55
- Object result = initializer . get () .bind (
54
+ Object result = this . binder .bind (
56
55
environment ("{\" key\" :{\" name\" :\" test\" }}" ), "key" ,
57
56
ResolvableType .forClass (SimpleBean .class ));
58
57
@@ -63,7 +62,7 @@ void defaultConstructor() throws Exception {
63
62
@ Test
64
63
void defaultConstructorWithNestedBeanProperty () throws Exception {
65
64
66
- Object result = initializer . get () .bind (
65
+ Object result = this . binder .bind (
67
66
environment (
68
67
"{\" key\" :{" +
69
68
"\" name\" :\" test name\" ," +
@@ -84,7 +83,7 @@ void defaultConstructorWithNestedBeanProperty() throws Exception {
84
83
@ Test
85
84
void defaultConstructorWithNestedBeanListProperty () throws Exception {
86
85
87
- Object result = initializer . get () .bind (
86
+ Object result = this . binder .bind (
88
87
environment ("{\" key\" :{\" items\" :[{\" name\" :\" first\" },{\" name\" :\" second\" }]}}" ), "key" ,
89
88
ResolvableType .forClass (ItemListHolder .class ));
90
89
@@ -96,7 +95,7 @@ void defaultConstructorWithNestedBeanListProperty() throws Exception {
96
95
@ Test // gh-301
97
96
void defaultConstructorWithNestedBeanListEmpty () throws Exception {
98
97
99
- Object result = initializer . get () .bind (
98
+ Object result = this . binder .bind (
100
99
environment ("{\" key\" :{\" items\" : []}}" ), "key" ,
101
100
ResolvableType .forClass (ItemListHolder .class ));
102
101
@@ -108,7 +107,7 @@ void defaultConstructorWithNestedBeanListEmpty() throws Exception {
108
107
void defaultConstructorBindingError () {
109
108
110
109
assertThatThrownBy (
111
- () -> initializer . get () .bind (
110
+ () -> this . binder .bind (
112
111
environment ("{\" key\" :{\" name\" :\" test\" ,\" age\" :\" invalid\" }}" ), "key" ,
113
112
ResolvableType .forClass (SimpleBean .class )))
114
113
.extracting (ex -> ((BindException ) ex ).getFieldErrors ())
@@ -123,7 +122,7 @@ void defaultConstructorBindingError() {
123
122
@ Test
124
123
void primaryConstructor () throws Exception {
125
124
126
- Object result = initializer . get () .bind (
125
+ Object result = this . binder .bind (
127
126
environment ("{\" key\" :{\" name\" :\" test\" }}" ), "key" ,
128
127
ResolvableType .forClass (PrimaryConstructorBean .class ));
129
128
@@ -134,7 +133,7 @@ void primaryConstructor() throws Exception {
134
133
@ Test
135
134
void primaryConstructorWithBeanArgument () throws Exception {
136
135
137
- Object result = initializer . get () .bind (
136
+ Object result = this . binder .bind (
138
137
environment (
139
138
"{\" key\" :{" +
140
139
"\" item\" :{\" name\" :\" Item name\" }," +
@@ -152,7 +151,7 @@ void primaryConstructorWithBeanArgument() throws Exception {
152
151
@ Test
153
152
void primaryConstructorWithNestedBeanList () throws Exception {
154
153
155
- Object result = initializer . get () .bind (
154
+ Object result = this . binder .bind (
156
155
environment (
157
156
"{\" key\" :{\" items\" :[" +
158
157
"{\" name\" :\" first\" }," +
@@ -168,7 +167,7 @@ void primaryConstructorWithNestedBeanList() throws Exception {
168
167
@ Test
169
168
void primaryConstructorNotFound () {
170
169
assertThatThrownBy (
171
- () -> initializer . get () .bind (
170
+ () -> this . binder .bind (
172
171
environment ("{\" key\" :{\" name\" :\" test\" }}" ), "key" ,
173
172
ResolvableType .forClass (NoPrimaryConstructorBean .class )))
174
173
.isInstanceOf (IllegalStateException .class )
@@ -179,7 +178,7 @@ void primaryConstructorNotFound() {
179
178
void primaryConstructorBindingError () {
180
179
181
180
assertThatThrownBy (
182
- () -> initializer . get () .bind (
181
+ () -> this . binder .bind (
183
182
environment (
184
183
"{\" key\" :{" +
185
184
"\" name\" :\" Hello\" ," +
@@ -205,7 +204,7 @@ void primaryConstructorBindingError() {
205
204
void primaryConstructorBindingErrorWithNestedBeanList () {
206
205
207
206
assertThatThrownBy (
208
- () -> initializer . get () .bind (
207
+ () -> this . binder .bind (
209
208
environment (
210
209
"{\" key\" :{\" items\" :[" +
211
210
"{\" name\" :\" first\" , \" age\" :\" invalid\" }," +
0 commit comments