#1953 Fix TODO items for: integrationtest-java8Test, integrationtest-lombokBuilderTest, processor-nullvaluemappingTest (#1955)

This commit is contained in:
Andrei Arlou 2019-10-26 22:24:59 +03:00 committed by GitHub
parent efea2fb662
commit b26cd4e0cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 16 deletions

View File

@ -10,6 +10,11 @@ import org.mapstruct.Mapper;
@Mapper
public interface SourceTargetBaseMapper {
// TODO.. move default and static interface method here when problem in eclipse processor is fixed.
default Foo fooFromId(long id) {
return new Foo(id);
}
static Bar barFromId(String id) {
return new Bar(id);
}
}

View File

@ -19,13 +19,4 @@ public interface SourceTargetMapper extends SourceTargetBaseMapper {
@Mapping(source = "idBar", target = "bar")
})
Target mapSourceToTarget(Source source);
default Foo fooFromId(long id) {
return new Foo(id);
}
static Bar barFromId(String id) {
return new Bar(id);
}
}

View File

@ -8,9 +8,7 @@ package org.mapstruct.itest.lombok;
import lombok.Builder;
import lombok.Getter;
//TODO make MapStruct DefaultBuilderProvider work with custom builder name
//@Builder(builderMethodName = "foo", buildMethodName = "create", builderClassName = "Builder")
@Builder(builderClassName = "Builder")
@Builder(builderMethodName = "foo", buildMethodName = "create", builderClassName = "Builder")
@Getter
public class Person {
private final String name;

View File

@ -19,13 +19,13 @@ public class LombokMapperTest {
@Test
public void testSimpleImmutableBuilderHappyPath() {
PersonDto personDto = PersonMapper.INSTANCE.toDto( Person.builder()
PersonDto personDto = PersonMapper.INSTANCE.toDto( Person.foo()
.age( 33 )
.name( "Bob" )
.address( Address.builder()
.addressLine( "Wild Drive" )
.build() )
.build() );
.create() );
assertThat( personDto.getAge() ).isEqualTo( 33 );
assertThat( personDto.getName() ).isEqualTo( "Bob" );
assertThat( personDto.getAddress() ).isNotNull();

View File

@ -39,7 +39,6 @@ public interface CarMapper {
@BeanMapping(nullValueMappingStrategy = RETURN_DEFAULT)
@Mappings({
@Mapping(target = "seatCount", source = "car.numberOfSeats"),
@Mapping(target = "model", source = "model"), // TODO, should not be needed, must be made based on name only
@Mapping(target = "catalogId", expression = "java( UUID.randomUUID().toString() )")
})
CarDto carToCarDto(Car car, String model);

View File

@ -83,6 +83,7 @@ public class NullValueMappingTest {
//then
assertThat( carDto1 ).isNotNull();
assertThat( carDto1.getMake() ).isEqualTo( car.getMake() );
assertThat( carDto1.getModel() ).isEqualTo( "ModelT" );
assertThat( carDto1.getSeatCount() ).isEqualTo( car.getNumberOfSeats() );
assertThat( carDto1.getCatalogId() ).isNotEmpty();