#187 adding unit test to make sure that reverse mapping also works for source constants

This commit is contained in:
sjaakd 2014-04-24 19:41:13 +02:00 committed by Gunnar Morling
parent e701801ec5
commit 5c27578db0
2 changed files with 19 additions and 0 deletions

View File

@ -64,6 +64,24 @@ public class SourceConstantsTest {
assertThat( target.getNameConstants() ).isEqualTo( Arrays.asList( "jack", "jill", "tom" ) );
}
@Test
@IssueKey( "187" )
@WithClasses( {
Source.class,
Target.class,
SourceTargetMapper.class,
StringListMapper.class
} )
public void shouldMapTargetToSourceWithoutWhining() throws ParseException {
Target target = new Target();
target.setPropertyThatShouldBeMapped( "SomeProperty" );
Source source = SourceTargetMapper.INSTANCE.targetToSource( target );
assertThat( source ).isNotNull();
assertThat( target.getPropertyThatShouldBeMapped() ).isEqualTo( "SomeProperty" );
}
@Test
@IssueKey( "187" )
@WithClasses( {

View File

@ -40,4 +40,5 @@ public interface SourceTargetMapper {
@Mapping( target = "nameConstants", expression = "jack-jill-tom" )
} )
Target sourceToTarget(Source s);
Source targetToSource(Target t);
}