4

I have a system where mapping of backend to frontend objects (DTOs) is mainly done by applying Dozer mappings selectively. Those mappings are configured via XML.

The code looks like this:

        scope2hits.get(scope)
              .add(getMapper().map(srcElement, TargetElement.class));

"Unfortunately" I wrote unit tests for the class containing the above code and since getMapper() returns a mocked (Mockito) Mapper, the resulting element is null. This is okay for testing amounts but not identity of returned elements.

Is there a way to unit test the class without building the complete context (including not copying the xml files to test context)?

Ronald
  • 111
  • 1
  • 7

0 Answers0