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 15
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
56cc7bd
commit f8da558
Showing
4 changed files
with
51 additions
and
2 deletions.
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
38 changes: 38 additions & 0 deletions
38
src/test/java/com/fasterxml/jackson/module/mrbean/RoundTripTest.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,38 @@ | ||
package com.fasterxml.jackson.module.mrbean; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class RoundTripTest extends BaseTest | ||
{ | ||
public interface Bean { | ||
String getField(); | ||
void setField(String field); | ||
} | ||
|
||
public interface ReadOnlyBean { | ||
String getField(); | ||
} | ||
|
||
// [mrbean#20]: naming convention caused under-score prefixed duplicates | ||
public void testSimple() throws Exception | ||
{ | ||
ObjectMapper mapper = new ObjectMapper() | ||
.registerModule(new MrBeanModule()); | ||
final String input = "{\"field\":\"testing\"}"; | ||
final Bean bean = mapper.readValue(input, Bean.class); | ||
assertEquals("testing", bean.getField()); | ||
final String output = mapper.writeValueAsString(bean); | ||
assertEquals(input, output); | ||
} | ||
|
||
public void testSimpleWithoutSetter() throws Exception | ||
{ | ||
ObjectMapper mapper = new ObjectMapper() | ||
.registerModule(new MrBeanModule()); | ||
final String input = "{\"field\":\"testing\"}"; | ||
final ReadOnlyBean bean = mapper.readValue(input, ReadOnlyBean.class); | ||
assertEquals("testing", bean.getField()); | ||
final String output = mapper.writeValueAsString(bean); | ||
assertEquals(input, output); | ||
} | ||
} |