-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add release notes for #184, rework a bit
- Loading branch information
1 parent
1754c4b
commit 8cde8aa
Showing
8 changed files
with
164 additions
and
169 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
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
57 changes: 57 additions & 0 deletions
57
.../src/test/java/com/fasterxml/jackson/datatype/jsr310/deser/DurationUnitConverterTest.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,57 @@ | ||
package com.fasterxml.jackson.datatype.jsr310.deser; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertNull; | ||
|
||
import java.time.temporal.ChronoUnit; | ||
|
||
import org.junit.Test; | ||
|
||
import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase; | ||
import com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.DurationUnitConverter; | ||
|
||
public class DurationUnitConverterTest | ||
extends ModuleTestBase | ||
{ | ||
@Test | ||
public void shouldMapToTemporalUnit() { | ||
for (ChronoUnit inputUnit : new ChronoUnit[] { | ||
ChronoUnit.NANOS, | ||
ChronoUnit.MICROS, | ||
ChronoUnit.MILLIS, | ||
ChronoUnit.SECONDS, | ||
ChronoUnit.MINUTES, | ||
ChronoUnit.HOURS, | ||
ChronoUnit.HALF_DAYS, | ||
ChronoUnit.DAYS, | ||
}) { | ||
DurationUnitConverter conv = DurationUnitConverter.from(inputUnit.name()); | ||
assertNotNull(conv); | ||
assertEquals(inputUnit, conv.unit); | ||
// is case-sensitive: | ||
assertNull(DurationUnitConverter.from(inputUnit.name().toLowerCase())); | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldNotMapToTemporalUnit() { | ||
for (String invalid : new String[] { | ||
// Inaccurate units not (yet?) supported | ||
"WEEKS", | ||
"MONTHS", | ||
"YEARS", | ||
"DECADES", | ||
"CENTURIES", | ||
"MILLENNIA", | ||
"ERAS", | ||
"FOREVER", | ||
|
||
// Not matching at all | ||
"DOESNOTMATCH", "", " " | ||
}) { | ||
assertNull("Should not map pattern '"+invalid+"'", | ||
DurationUnitConverter.from(invalid)); | ||
} | ||
} | ||
} |
59 changes: 0 additions & 59 deletions
59
...rc/test/java/com/fasterxml/jackson/datatype/jsr310/deser/DurationUnitParserEmptyTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.