File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
main/java/com/fasterxml/jackson/databind/cfg
test/java/com/fasterxml/jackson/databind Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,12 @@ public enum EnumFeature implements DatatypeFeature
29
29
* Enum values: if enabled, return value of <code>Enum.name().toLowerCase()</code>
30
30
* is used; if disabled, return value of <code>Enum.name()</code> is used.
31
31
*<p>
32
+ * NOTE: this feature CAN NOT be changed on per-call basis: it will have to
33
+ * be set on {@code ObjectMapper} before use
34
+ *<p>
32
35
* Feature is disabled by default.
36
+ *
37
+ * @since 2.15
33
38
*/
34
39
WRITE_ENUMS_TO_LOWERCASE (false );
35
40
Original file line number Diff line number Diff line change @@ -332,6 +332,7 @@ public void testEnumWithJsonKey() throws Exception
332
332
assertEquals (a2q ("{'key:a':'value:b'}" ), MAPPER .writeValueAsString (input2 ));
333
333
}
334
334
335
+ // [databind#3053]
335
336
public void testEnumFeature_WRITE_ENUMS_TO_LOWERCASE_isDisabledByDefault () {
336
337
ObjectReader READER = MAPPER .reader ();
337
338
assertFalse (READER .isEnabled (EnumFeature .WRITE_ENUMS_TO_LOWERCASE ));
@@ -343,12 +344,8 @@ public void testEnumFeature_WRITE_ENUMS_TO_LOWERCASE() throws Exception {
343
344
ObjectMapper m = jsonMapperBuilder ()
344
345
.configure (EnumFeature .WRITE_ENUMS_TO_LOWERCASE , true )
345
346
.build ();
346
- assertEquals ("\" b\" " , m .writeValueAsString (TestEnum .B ));
347
-
348
- // [databind#749] but should also be able to dynamically disable
349
- assertEquals ("\" B\" " ,
350
- m .writer ().without (EnumFeature .WRITE_ENUMS_TO_LOWERCASE )
351
- .writeValueAsString (LowerCaseEnum .B ));
347
+ assertEquals (q ("b" ), m .writeValueAsString (TestEnum .B ));
348
+ // NOTE: cannot be dynamically changed
352
349
}
353
350
}
354
351
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ public void testEnumResolver()
66
66
assertEquals (ABC .C , enums .get (2 ));
67
67
}
68
68
69
+ // [databind#3053]
69
70
@ SuppressWarnings ("unchecked" )
70
71
public void testConstructFromNameLowerCased () {
71
72
SerializationConfig cfg = MAPPER .getSerializationConfig ()
You can’t perform that action at this time.
0 commit comments