Search in sources :

Example 1 with SpaceshipDto

use of org.mapstruct.ap.test.imports.sourcewithextendsbound.dto.SpaceshipDto in project mapstruct by mapstruct.

the class SourceTypeContainsCollectionWithExtendsBoundTest method generatesImportsForCollectionWithExtendsBoundInSourceType.

@ProcessorTest
@IssueKey("768")
public void generatesImportsForCollectionWithExtendsBoundInSourceType() {
    Astronaut astronaut = new Astronaut();
    astronaut.setName("Bob");
    Spaceship spaceship = new Spaceship();
    spaceship.setAstronauts(Collections.singleton(astronaut));
    SpaceshipDto spaceshipDto = SpaceshipMapper.INSTANCE.spaceshipToDto(spaceship);
    assertThat(spaceshipDto).isNotNull();
    assertThat(spaceshipDto.getAstronauts()).extracting("name").containsOnly("Bob");
    generatedSource.forMapper(SpaceshipMapper.class).containsImportFor(Astronaut.class);
    generatedSource.forMapper(SpaceshipMapper.class).containsImportFor(Spaceship.class);
    generatedSource.forMapper(SpaceshipMapper.class).containsImportFor(AstronautDto.class);
    generatedSource.forMapper(SpaceshipMapper.class).containsImportFor(SpaceshipDto.class);
}
Also used : Astronaut(org.mapstruct.ap.test.imports.sourcewithextendsbound.entity.Astronaut) SpaceshipDto(org.mapstruct.ap.test.imports.sourcewithextendsbound.dto.SpaceshipDto) Spaceship(org.mapstruct.ap.test.imports.sourcewithextendsbound.entity.Spaceship) IssueKey(org.mapstruct.ap.testutil.IssueKey) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

SpaceshipDto (org.mapstruct.ap.test.imports.sourcewithextendsbound.dto.SpaceshipDto)1 Astronaut (org.mapstruct.ap.test.imports.sourcewithextendsbound.entity.Astronaut)1 Spaceship (org.mapstruct.ap.test.imports.sourcewithextendsbound.entity.Spaceship)1 IssueKey (org.mapstruct.ap.testutil.IssueKey)1 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)1