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.
fixup! fixup! fixup! fixup! fixup! Support for jsonformat in duration…
… deserializer based on Duration::of(long,TemporalUnit). ref FasterXML#184
- Loading branch information
1 parent
343abbc
commit c481399
Showing
3 changed files
with
30 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
12 changes: 6 additions & 6 deletions
12
...sr310/deser/DurationPatternEmptyTest.java → ...10/deser/DurationUnitParserEmptyTest.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 |
---|---|---|
@@ -1,30 +1,30 @@ | ||
package com.fasterxml.jackson.datatype.jsr310.deser; | ||
|
||
import com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.DurationPattern; | ||
import com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.DurationUnitParser; | ||
import org.junit.Test; | ||
|
||
import static java.util.Optional.empty; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class DurationPatternEmptyTest { | ||
public class DurationUnitParserEmptyTest { | ||
|
||
@Test | ||
public void shouldReturnEmpty_whenNull() { | ||
assertEquals(empty(), DurationPattern.from(null)); | ||
assertEquals(empty(), DurationUnitParser.from(null)); | ||
} | ||
|
||
@Test | ||
public void shouldReturnEmpty_whenEmptyString() { | ||
assertEquals(empty(), DurationPattern.from("")); | ||
assertEquals(empty(), DurationUnitParser.from("")); | ||
} | ||
|
||
@Test | ||
public void shouldReturnEmpty_whenSpaces() { | ||
assertEquals(empty(), DurationPattern.from(" ")); | ||
assertEquals(empty(), DurationUnitParser.from(" ")); | ||
} | ||
|
||
@Test | ||
public void shouldReturnEmpty_whenDoesNotMatchAnyTemporalUnit() { | ||
assertEquals(empty(), DurationPattern.from("DOESNOTMATCH")); | ||
assertEquals(empty(), DurationUnitParser.from("DOESNOTMATCH")); | ||
} | ||
} |
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