mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#187 adding unit test to make sure that reverse mapping also works for source constants
This commit is contained in:
parent
e701801ec5
commit
5c27578db0
@ -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( {
|
||||
|
@ -40,4 +40,5 @@ public interface SourceTargetMapper {
|
||||
@Mapping( target = "nameConstants", expression = "jack-jill-tom" )
|
||||
} )
|
||||
Target sourceToTarget(Source s);
|
||||
Source targetToSource(Target t);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user