This repository has been archived by the owner on Nov 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from jwijgerd/master
fix for issue #48
- Loading branch information
Showing
3 changed files
with
50 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
22 changes: 22 additions & 0 deletions
22
...t/java/com/fasterxml/jackson/module/afterburner/bug48/TestJsonSerializeAnnotationBug.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,22 @@ | ||
package com.fasterxml.jackson.module.afterburner.bug48; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.module.afterburner.AfterburnerModule; | ||
import com.fasterxml.jackson.module.afterburner.AfterburnerTestBase; | ||
|
||
import java.math.BigDecimal; | ||
|
||
/** | ||
* @author Joost van de Wijgerd | ||
*/ | ||
public class TestJsonSerializeAnnotationBug extends AfterburnerTestBase { | ||
public void testAfterburnerModule() throws JsonProcessingException { | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
objectMapper.registerModule(new AfterburnerModule()); | ||
|
||
String value = objectMapper.writeValueAsString(new TestObjectWithJsonSerialize(new BigDecimal("870.04"))); | ||
|
||
|
||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...test/java/com/fasterxml/jackson/module/afterburner/bug48/TestObjectWithJsonSerialize.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,26 @@ | ||
package com.fasterxml.jackson.module.afterburner.bug48; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
|
||
import java.math.BigDecimal; | ||
|
||
/** | ||
* @author Joost van de Wijgerd | ||
*/ | ||
public final class TestObjectWithJsonSerialize { | ||
@JsonSerialize(using = ToStringSerializer.class) | ||
private final BigDecimal amount; | ||
|
||
@JsonCreator | ||
public TestObjectWithJsonSerialize(@JsonProperty("amount") BigDecimal amount) { | ||
this.amount = amount; | ||
} | ||
|
||
@JsonSerialize(using = ToStringSerializer.class) @JsonProperty("amount") | ||
public BigDecimal getAmount() { | ||
return amount; | ||
} | ||
} |