@@ -28,6 +28,10 @@ record NestedRecordTwo(String id, String passport) {}
28
28
29
29
record CABRecord (String c , String a , String b ) {}
30
30
31
+ record JsonPropertyRecord (@ JsonProperty ("aa" ) int a , int b ) {}
32
+
33
+ record JsonPropertyRecord2 (int a , @ JsonProperty ("bb" ) int b ) {}
34
+
31
35
private final ObjectMapper MAPPER = newJsonMapper ();
32
36
33
37
/*
@@ -45,6 +49,22 @@ public void testSerializationOrder() throws Exception {
45
49
assertEquals (expected , output );
46
50
}
47
51
52
+ @ Test
53
+ public void testBasicSerializationOrderWithJsonProperty () throws Exception {
54
+ JsonPropertyRecord jsonPropertyRecord = new JsonPropertyRecord (1 , 2 );
55
+ final String output = MAPPER .writeValueAsString (jsonPropertyRecord );
56
+ final String expected = "{\" aa\" :1,\" b\" :2}" ;
57
+ assertEquals (expected , output );
58
+ }
59
+
60
+ @ Test
61
+ public void testBasicSerializationOrderWithJsonProperty2 () throws Exception {
62
+ JsonPropertyRecord2 jsonPropertyRecord = new JsonPropertyRecord2 (1 , 2 );
63
+ final String output = MAPPER .writeValueAsString (jsonPropertyRecord );
64
+ final String expected = "{\" a\" :1,\" bb\" :2}" ;
65
+ assertEquals (expected , output );
66
+ }
67
+
48
68
@ Test
49
69
public void testSerializationOrderWithJsonProperty () throws Exception {
50
70
NestedRecordTwo nestedRecordTwo = new NestedRecordTwo ("2" , "111110" );
0 commit comments