-
Notifications
You must be signed in to change notification settings - Fork 118
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
7ef16bb
commit 8061ede
Showing
4 changed files
with
56 additions
and
26 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
40 changes: 40 additions & 0 deletions
40
datatypes/src/test/java/com/fasterxml/jackson/failing/ContextualOptional17Test.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,40 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.util.Date; | ||
import java.util.Optional; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.datatype.jdk8.ModuleTestBase; | ||
|
||
public class ContextualOptional17Test extends ModuleTestBase | ||
{ | ||
// [datatypes-java8#17] | ||
@JsonPropertyOrder({ "date1", "date2" }) | ||
static class ContextualOptionals | ||
{ | ||
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd") | ||
public Optional<Date> date1; | ||
|
||
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM") | ||
public Optional<Date> date2; | ||
} | ||
|
||
/* | ||
/********************************************************** | ||
/* Test methods | ||
/********************************************************** | ||
*/ | ||
|
||
private final ObjectMapper MAPPER = mapperWithModule(); | ||
|
||
public void testContextualOptionals() throws Exception | ||
{ | ||
ContextualOptionals input = new ContextualOptionals(); | ||
input.date1 = Optional.ofNullable(new Date(0L)); | ||
input.date2 = Optional.ofNullable(new Date(0L)); | ||
assertEquals(aposToQuotes("{'date1':'1970-01-01','date2':'1970-01'"), | ||
MAPPER.writeValueAsString(input)); | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
datatypes/src/test/java/com/fasterxml/jackson/failing/OptionalnclusionTest.java
This file was deleted.
Oops, something went wrong.