#41 Adding test; Actual issue was fixed by previous refactorings

This commit is contained in:
Gunnar Morling 2013-07-06 10:30:56 +02:00
parent 1972f36ec1
commit b3654979ad
4 changed files with 27 additions and 0 deletions

View File

@ -44,4 +44,15 @@ public class OnewayTest extends MapperTestBase {
assertThat( target ).isNotNull();
assertThat( target.retrieveFoo() ).isEqualTo( Long.valueOf( 42 ) );
}
@Test
@IssueKey("41")
public void shouldReverseMapAttributeWithoutSetterInTargetType() {
Target target = new Target();
Source source = SourceTargetMapper.INSTANCE.targetToSource( target );
assertThat( source ).isNotNull();
assertThat( source.retrieveBar() ).isEqualTo( 23 );
}
}

View File

@ -21,8 +21,17 @@ package org.mapstruct.ap.test.oneway;
public class Source {
private int foo = 42;
private int bar;
public int getFoo() {
return foo;
}
public void setBar(int bar) {
this.bar = bar;
}
public int retrieveBar() {
return bar;
}
}

View File

@ -27,4 +27,6 @@ public interface SourceTargetMapper {
SourceTargetMapper INSTANCE = Mappers.getMapper( SourceTargetMapper.class );
Target sourceToTarget(Source source);
Source targetToSource(Target target);
}

View File

@ -21,6 +21,7 @@ package org.mapstruct.ap.test.oneway;
public class Target {
private Long foo;
private int bar = 23;
public void setFoo(Long foo) {
this.foo = foo;
@ -29,4 +30,8 @@ public class Target {
public Long retrieveFoo() {
return foo;
}
public int getBar() {
return bar;
}
}