-
-
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.
Add a test for #2787, partial fix (no more NPE, now fails otherwise)
- Loading branch information
1 parent
a8dda6b
commit eeac38b
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
42 changes: 42 additions & 0 deletions
42
src/test/java/com/fasterxml/jackson/failing/EnumDeserialization2787Test.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,42 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class EnumDeserialization2787Test extends BaseMapTest | ||
{ | ||
// [databind#2787] | ||
static enum SomeEnum2787 { | ||
none, | ||
tax10, | ||
tax20 | ||
} | ||
|
||
static enum SomeEnumMixin2787 { | ||
@JsonProperty("zero") | ||
none, | ||
@JsonProperty("TypTyp") | ||
tax10, | ||
@JsonProperty("PytPyt") | ||
tax20 | ||
} | ||
|
||
/* | ||
/********************************************************** | ||
/* Test methods | ||
/********************************************************** | ||
*/ | ||
|
||
protected final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
// [databind#2787] | ||
public void testMixinOnEnumValues2787() throws Exception | ||
{ | ||
ObjectMapper mapper = jsonMapperBuilder() | ||
.addMixIn(SomeEnum2787.class, SomeEnumMixin2787.class) | ||
.build(); | ||
SomeEnum2787 result = mapper.readValue(quote("zero"), SomeEnum2787.class); | ||
assertEquals(SomeEnum2787.none, result); | ||
} | ||
} |