File tree 2 files changed +44
-0
lines changed
src/test/java/com/fasterxml/jackson/databind
2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .databind .deser .enums ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+
5
+ import com .fasterxml .jackson .annotation .JsonProperty ;
6
+
7
+ import com .fasterxml .jackson .databind .ObjectMapper ;
8
+ import com .fasterxml .jackson .databind .PropertyNamingStrategies ;
9
+ import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
10
+
11
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
12
+
13
+ // for [databind#4409
14
+ public class EnumDeserDupName4409Test extends DatabindTestUtil
15
+ {
16
+ // for [databind#4409
17
+ enum ColorMode4409Snake {
18
+ // Will become "rgb"
19
+ RGB ,
20
+ // Will become "rgba"
21
+ RGBa ,
22
+ // Will become "rgba" as well unless overriden, so:
23
+ @ JsonProperty ("RGBA" )
24
+ RGBA
25
+ }
26
+
27
+ private final ObjectMapper MAPPER = jsonMapperBuilder ()
28
+ .propertyNamingStrategy (PropertyNamingStrategies .SNAKE_CASE )
29
+ .build ();
30
+
31
+ // for [databind#4409
32
+ @ Test
33
+ public void dupNameConflict4409 () throws Exception
34
+ {
35
+ assertEquals (ColorMode4409Snake .RGBa ,
36
+ MAPPER .readValue (q ("RGBa" ), ColorMode4409Snake .class ));
37
+
38
+ assertEquals (q ("RGBA" ),
39
+ MAPPER .writeValueAsString (ColorMode4409Snake .RGBA ));
40
+ }
41
+ }
Original file line number Diff line number Diff line change @@ -238,6 +238,9 @@ public void setUtcZone(String utcZone) {
238
238
{"uId" , "u_id" },
239
239
// [databind#2267]
240
240
{"xCoordinate" , "x_coordinate" },
241
+ // [databind#4409]
242
+ {"RGBA" , "rgba" },
243
+ {"RGBa" , "rgba" },
241
244
});
242
245
243
246
final static List <Object []> UPPER_SNAKE_CASE_NAME_TRANSLATIONS = Arrays .asList (new Object [][] {
You can’t perform that action at this time.
0 commit comments