File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
src/test/java/com/jsoniter Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 9
9
import junit .framework .TestCase ;
10
10
11
11
import java .io .IOException ;
12
- import java .lang .reflect .Constructor ;
13
- import java .lang .reflect .Field ;
14
- import java .lang .reflect .Method ;
15
- import java .lang .reflect .Modifier ;
12
+ import java .lang .reflect .*;
13
+ import java .util .Arrays ;
16
14
import java .util .Map ;
17
15
18
16
public class TestRecord extends TestCase {
@@ -203,6 +201,22 @@ public TestRecord6(int valInt) {
203
201
assertNotNull (record );
204
202
}
205
203
204
+ public void test_record_2_constructors_secondCtorUse_withOnlyFieldDecoder () throws IOException {
205
+
206
+ record TestRecord6 (long val ) {
207
+
208
+ @ JsonCreator
209
+ public TestRecord6 (@ JsonProperty ("valInt" ) int valInt ) {
210
+ this (Long .valueOf (valInt ));
211
+ }
212
+ }
213
+
214
+ JsonIterator iter = JsonIterator .parse ("{ 'valInt' : 1 }" .replace ('\'' , '"' ));
215
+ TestRecord6 record = iter .read (TestRecord6 .class );
216
+
217
+ assertNotNull (record );
218
+ }
219
+
206
220
public void test_record_withCtorDecoder () throws IOException {
207
221
208
222
record TestRecord2 (@ JsonProperty long field1 ) {
You can’t perform that action at this time.
0 commit comments