Package org.mapstruct.ap.test.complex.target

Examples of org.mapstruct.ap.test.complex.target.CarDto


    }

    @Test
    public void shouldReverseMapIterableAttribute() {
        //given
        CarDto carDto = new CarDto(
            "Morris",
            2,
            "1980",
            new PersonDto( "Bob" ),
            new ArrayList<PersonDto>( Arrays.asList( new PersonDto( "Alice" ), new PersonDto( "Bill" ) ) )
View Full Code Here


    public void shouldMapEnumToString() {
        //given
        Car car = new Car();
        car.setCategory( Category.CONVERTIBLE );
        //when
        CarDto carDto = CarMapper.INSTANCE.carToCarDto( car );

        //then
        assertThat( carDto ).isNotNull();
        assertThat( carDto.getCategory() ).isEqualTo( "CONVERTIBLE" );
    }
View Full Code Here

    }

    @Test
    public void shouldMapStringToEnum() {
        //given
        CarDto carDto = new CarDto();
        carDto.setCategory( "CONVERTIBLE" );
        //when
        Car car = CarMapper.INSTANCE.carDtoToCar( carDto );

        //then
        assertThat( car ).isNotNull();
View Full Code Here

            new Person( "Bob" ),
            new ArrayList<Person>()
        );

        //when
        CarDto carDto = CarMapper.INSTANCE.carToCarDto( car );

        //then
        assertThat( carDto ).isNotNull();
        assertThat( carDto.getMake() ).isEqualTo( car.getMake() );
    }
View Full Code Here

            new Person( "Bob" ),
            new ArrayList<Person>()
        );

        //when
        CarDto carDto = CarMapper.INSTANCE.carToCarDto( car );

        //then
        assertThat( carDto ).isNotNull();
        assertThat( carDto.getDriver() ).isNotNull();
        assertThat( carDto.getDriver().getName() ).isEqualTo( "Bob" );
    }
View Full Code Here

    }

    @Test
    public void shouldReverseMapReferenceAttribute() {
        //given
        CarDto carDto = new CarDto( "Morris", 2, "1980", new PersonDto( "Bob" ), new ArrayList<PersonDto>() );

        //when
        Car car = CarMapper.INSTANCE.carDtoToCar( carDto );

        //then
View Full Code Here

            new Person( "Bob" ),
            new ArrayList<Person>()
        );

        //when
        CarDto carDto = CarMapper.INSTANCE.carToCarDto( car );

        //then
        assertThat( carDto ).isNotNull();
        assertThat( carDto.getSeatCount() ).isEqualTo( car.getNumberOfSeats() );
    }
View Full Code Here

    }

    @Test
    public void shouldConsiderCustomMappingForReverseMapping() {
        //given
        CarDto carDto = new CarDto( "Morris", 2, "1980", new PersonDto( "Bob" ), new ArrayList<PersonDto>() );

        //when
        Car car = CarMapper.INSTANCE.carDtoToCar( carDto );

        //then
        assertThat( car ).isNotNull();
        assertThat( car.getNumberOfSeats() ).isEqualTo( carDto.getSeatCount() );
    }
View Full Code Here

            new Person( "Bob" ),
            new ArrayList<Person>()
        );

        //when
        CarDto carDto = CarMapper.INSTANCE.carToCarDto( car );

        //then
        assertThat( carDto ).isNotNull();
        assertThat( carDto.getManufacturingYear() ).isEqualTo( "1980" );
    }
View Full Code Here

    }

    @Test
    public void shouldApplyConverterForReverseMapping() {
        //given
        CarDto carDto = new CarDto( "Morris", 2, "1980", new PersonDto( "Bob" ), new ArrayList<PersonDto>() );

        //when
        Car car = CarMapper.INSTANCE.carDtoToCar( carDto );

        //then
View Full Code Here

TOP

Related Classes of org.mapstruct.ap.test.complex.target.CarDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.