@Test
public void convert() throws Exception {

    DurationConverter conv = new DurationConverter();
    Duration duration = conv.convert("PT20.345S", context);
    assertThat(duration).isEqualTo(Duration.parse("PT20.345S"));
    duration = conv.convert("PT15M", context);
    assertThat(duration).isEqualTo(Duration.parse("PT15M"));
    duration = conv.convert("PT10H", context);
    assertThat(duration).isEqualTo(Duration.parse("PT10H"));
    duration = conv.convert("P2D", context);
    assertThat(duration).isEqualTo(Duration.parse("P2D"));
    duration = conv.convert("P2DT3H4M", context);
    assertThat(duration).isEqualTo(Duration.parse("P2DT3H4M"));
    duration = conv.convert("foo", context);
    assertThat(duration).isNull();
}