Skip to content

Commit

Permalink
Add failing test to cover FasterXML#148
Browse files Browse the repository at this point in the history
  • Loading branch information
Samantha Williamson committed Oct 30, 2019
1 parent 7b4d75d commit e72baae
Showing 1 changed file with 32 additions and 0 deletions.
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);
}
}

0 comments on commit e72baae

Please sign in to comment.