forked from FasterXML/jackson-modules-java8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add failing test to cover FasterXML#148
- Loading branch information
Samantha Williamson
committed
Oct 30, 2019
1 parent
7b4d75d
commit e72baae
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/failing/LocalDateDeserTest.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,32 @@ | ||
package com.fasterxml.jackson.datatype.jsr310.failing; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.OptBoolean; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.exc.InvalidFormatException; | ||
import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase; | ||
import org.junit.Test; | ||
|
||
import java.time.LocalDate; | ||
|
||
/** | ||
* | ||
*/ | ||
public class LocalDateDeserTest extends ModuleTestBase { | ||
private final ObjectMapper MAPPER = newMapper(); | ||
|
||
final static class StrictWrapper { | ||
@JsonFormat(pattern="yyyy-MM-dd", | ||
lenient = OptBoolean.FALSE) | ||
public LocalDate value; | ||
|
||
public StrictWrapper() { } | ||
public StrictWrapper(LocalDate v) { value = v; } | ||
} | ||
|
||
@Test(expected = InvalidFormatException.class) | ||
public void testStrictCustomFormat() throws Exception | ||
{ | ||
StrictWrapper w = MAPPER.readValue("{\"value\":\"2019-11-31\"}", StrictWrapper.class); | ||
} | ||
} |