This repository has been archived by the owner on Nov 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
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
580210e
commit 1dc3548
Showing
2 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/test/java/com/fasterxml/jackson/module/paramnames/EnumNamingTest.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,35 @@ | ||
package com.fasterxml.jackson.module.paramnames; | ||
|
||
import org.junit.Test; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class EnumNamingTest | ||
{ | ||
enum SurprisingEnum32 { | ||
@JsonProperty("customValue") | ||
ENUM_NAME; | ||
} | ||
|
||
// for [module-parameter-names#32] | ||
@Test | ||
public void testCustomEnumName() throws Exception | ||
{ | ||
final String EXP = "\"customValue\""; | ||
|
||
// First, verify default handling | ||
|
||
String json = new ObjectMapper() | ||
.writeValueAsString(SurprisingEnum32.ENUM_NAME); | ||
assertEquals(EXP, json); | ||
|
||
// and then with parameter names module | ||
json = new ObjectMapper() | ||
.registerModule(new ParameterNamesModule()) | ||
.writeValueAsString(SurprisingEnum32.ENUM_NAME); | ||
assertEquals(EXP, json); | ||
} | ||
} |
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