mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-26 00:00:05 +08:00
#41 Adding test; Actual issue was fixed by previous refactorings
This commit is contained in:
parent
1972f36ec1
commit
b3654979ad
@ -44,4 +44,15 @@ public class OnewayTest extends MapperTestBase {
|
|||||||
assertThat( target ).isNotNull();
|
assertThat( target ).isNotNull();
|
||||||
assertThat( target.retrieveFoo() ).isEqualTo( Long.valueOf( 42 ) );
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,17 @@ package org.mapstruct.ap.test.oneway;
|
|||||||
public class Source {
|
public class Source {
|
||||||
|
|
||||||
private int foo = 42;
|
private int foo = 42;
|
||||||
|
private int bar;
|
||||||
|
|
||||||
public int getFoo() {
|
public int getFoo() {
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBar(int bar) {
|
||||||
|
this.bar = bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int retrieveBar() {
|
||||||
|
return bar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,6 @@ public interface SourceTargetMapper {
|
|||||||
SourceTargetMapper INSTANCE = Mappers.getMapper( SourceTargetMapper.class );
|
SourceTargetMapper INSTANCE = Mappers.getMapper( SourceTargetMapper.class );
|
||||||
|
|
||||||
Target sourceToTarget(Source source);
|
Target sourceToTarget(Source source);
|
||||||
|
|
||||||
|
Source targetToSource(Target target);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package org.mapstruct.ap.test.oneway;
|
|||||||
public class Target {
|
public class Target {
|
||||||
|
|
||||||
private Long foo;
|
private Long foo;
|
||||||
|
private int bar = 23;
|
||||||
|
|
||||||
public void setFoo(Long foo) {
|
public void setFoo(Long foo) {
|
||||||
this.foo = foo;
|
this.foo = foo;
|
||||||
@ -29,4 +30,8 @@ public class Target {
|
|||||||
public Long retrieveFoo() {
|
public Long retrieveFoo() {
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBar() {
|
||||||
|
return bar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user