Example #1
0
  @Test
  public void shouldApplyBuiltInXmlGregCalToString()
      throws ParseException, DatatypeConfigurationException {

    XmlGregorianCalendarProperty source = new XmlGregorianCalendarProperty();
    source.setProp(createXmlCal(1999, 3, 2, 60));
    source.publicProp = createXmlCal(2016, 3, 2, 60);

    StringProperty target = XmlGregCalToStringMapper.INSTANCE.mapAndFormat(source);
    assertThat(target).isNotNull();
    assertThat(target.getProp()).isNotNull();
    assertThat(target.getProp()).isEqualTo("02.03.1999");
    assertThat(target.publicProp).isNotNull();
    assertThat(target.publicProp).isEqualTo("02.03.2016");

    source.setProp(createXmlCal(1999, 3, 2, 60));
    source.publicProp = createXmlCal(2016, 3, 2, 60);

    target = XmlGregCalToStringMapper.INSTANCE.map(source);
    assertThat(target).isNotNull();
    assertThat(target.getProp()).isNotNull();
    assertThat(target.getProp()).isEqualTo("1999-03-02+01:00");
    assertThat(target.publicProp).isNotNull();
    assertThat(target.publicProp).isEqualTo("2016-03-02+01:00");
  }
Example #2
0
  @Test
  public void shouldApplyBuiltInOnXmlGregCalToDate()
      throws ParseException, DatatypeConfigurationException {

    XmlGregorianCalendarProperty source = new XmlGregorianCalendarProperty();
    source.setProp(createXmlCal(1999, 3, 2, 60));
    source.publicProp = createXmlCal(2016, 3, 2, 60);

    DateProperty target = XmlGregCalToDateMapper.INSTANCE.map(source);
    assertThat(target).isNotNull();
    assertThat(target.getProp()).isNotNull();
    assertThat(target.getProp().toString()).isEqualTo("Tue Mar 02 00:00:00 CET 1999");
    assertThat(target.publicProp).isNotNull();
    assertThat(target.publicProp.toString()).isEqualTo("Wed Mar 02 00:00:00 CET 2016");
  }
Example #3
0
  @Test
  public void shouldApplyBuiltInOnXmlGregCalToCalendar()
      throws ParseException, DatatypeConfigurationException {

    XmlGregorianCalendarProperty source = new XmlGregorianCalendarProperty();
    source.setProp(createXmlCal(1999, 3, 2, 60));
    source.publicProp = createXmlCal(2016, 3, 2, 60);

    CalendarProperty target = XmlGregCalToCalendarMapper.INSTANCE.map(source);
    assertThat(target).isNotNull();
    assertThat(target.getProp()).isNotNull();
    assertThat(target.getProp().getTimeInMillis()).isEqualTo(920329200000L);
    assertThat(target.publicProp).isNotNull();
    assertThat(target.publicProp.getTimeInMillis()).isEqualTo(1456873200000L);
    assertThat(target.publicProp.getTimeInMillis()).isEqualTo(1456873200000L);
  }