-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fb5b8d
commit 8956915
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserDupName4409Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.fasterxml.jackson.databind.deser.enums; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
// for [databind#4409 | ||
public class EnumDeserDupName4409Test extends DatabindTestUtil | ||
{ | ||
// for [databind#4409 | ||
enum ColorMode4409Snake { | ||
// Will become "rgb" | ||
RGB, | ||
// Will become "rgba" | ||
RGBa, | ||
// Will become "rgba" as well unless overriden, so: | ||
@JsonProperty("RGBA") | ||
RGBA | ||
} | ||
|
||
private final ObjectMapper MAPPER = jsonMapperBuilder() | ||
.propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) | ||
.build(); | ||
|
||
// for [databind#4409 | ||
@Test | ||
public void dupNameConflict4409() throws Exception | ||
{ | ||
assertEquals(ColorMode4409Snake.RGBa, | ||
MAPPER.readValue(q("RGBa"), ColorMode4409Snake.class)); | ||
|
||
assertEquals(q("RGBA"), | ||
MAPPER.writeValueAsString(ColorMode4409Snake.RGBA)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters