Search in sources :

Example 1 with MapSource

use of org.mapstruct.ap.test.builtin.source.MapSource in project mapstruct by mapstruct.

the class BuiltInTest method shouldApplyBuiltInOnMap.

@ProcessorTest
@WithClasses({ MapSourceTargetMapper.class, MapSource.class })
@WithJavaxJaxb
public void shouldApplyBuiltInOnMap() throws DatatypeConfigurationException {
    MapSource source = new MapSource();
    source.setExample(new HashMap<>());
    source.getExample().put(createJaxb("TEST"), createXmlCal(1999, 3, 2, 60));
    source.publicExample = new HashMap<>();
    source.publicExample.put(createJaxb("TEST"), createXmlCal(2016, 3, 2, 60));
    MapTarget target = MapSourceTargetMapper.INSTANCE.sourceToTarget(source);
    assertThat(target).isNotNull();
    assertThat(target.getExample().get("TEST")).isEqualTo("1999-03-02+01:00");
    assertThat(target.publicExample.get("TEST")).isEqualTo("2016-03-02+01:00");
}
Also used : MapSource(org.mapstruct.ap.test.builtin.source.MapSource) MapTarget(org.mapstruct.ap.test.builtin._target.MapTarget) WithJavaxJaxb(org.mapstruct.ap.testutil.WithJavaxJaxb) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest) WithClasses(org.mapstruct.ap.testutil.WithClasses)

Aggregations

MapTarget (org.mapstruct.ap.test.builtin._target.MapTarget)1 MapSource (org.mapstruct.ap.test.builtin.source.MapSource)1 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)1 WithClasses (org.mapstruct.ap.testutil.WithClasses)1 WithJavaxJaxb (org.mapstruct.ap.testutil.WithJavaxJaxb)1