Skip to content

Commit e03e9ba

Browse files
committed
Try to reproduce #1626, not failing
1 parent 4a2b1ae commit e03e9ba

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/EnumDeserializationTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,17 @@ public static ObjectMapper setupObjectMapper(ObjectMapper mapper) {
170170
}
171171
}
172172

173+
// [databind#1626]
174+
enum NumberEnum {
175+
@JsonProperty("2")
176+
EN2,
177+
@JsonProperty("0")
178+
EN0,
179+
@JsonProperty("1")
180+
EN1
181+
;
182+
}
183+
173184
/*
174185
/**********************************************************
175186
/* Test methods
@@ -510,4 +521,12 @@ public void testExceptionFromCustomEnumKeyDeserializer() {
510521
assertTrue(e.getMessage().contains("Undefined AnEnum"));
511522
}
512523
}
524+
525+
// [databind#1626]
526+
public void testNumericEnumName() throws Exception
527+
{
528+
String json = MAPPER.writeValueAsString(NumberEnum.EN2);
529+
assertEquals(quote("2"), json);
530+
assertEquals(NumberEnum.EN2, MAPPER.readValue(json, NumberEnum.class));
531+
}
513532
}

0 commit comments

Comments
 (0)