Skip to content

Commit

Permalink
Merge branch '2.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 11, 2023
2 parents 20c8c6d + 74a058b commit cf02b97
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ static class MyDto224 {
public Duration getDuration() { return duration; }
}

// [datetime#282]
static class Bean282 {
@JsonFormat(pattern = "SECONDS")
public Duration duration;

public Bean282(Duration d) { duration = d; }
}

@Test
public void testSerializationAsTimestampNanoseconds01() throws Exception
{
Expand Down Expand Up @@ -362,9 +370,19 @@ protected ObjectMapper _mapperForPatternOverride(String pattern) {

// [datetime#224]
@Test
public void testDurationFormatOverride() throws Exception
public void testDurationFormatOverrideMinutes() throws Exception
{
assertEquals(a2q("{'mins':120}"),
WRITER.writeValueAsString(new MyDto224(Duration.ofHours(2))));
}

// [datetime#282]
@Test
public void testDurationFormatOverrideSeconds() throws Exception
{
final Duration maxDuration = Duration.ofSeconds(Long.MIN_VALUE);
assertEquals(a2q("{'duration':"+Long.MIN_VALUE+"}"),
WRITER.writeValueAsString(new Bean282(maxDuration)));
}

}

0 comments on commit cf02b97

Please sign in to comment.