@Test public void whenToDomainAddPayloadFromApiAddRequest() throws EntityNotFoundException { AddEventRequest apiAddRequest = ApiRequestTestUtils.fullAddEvent(); EventAddPayload expected = DomainPayloadTestUtils.fullEventAdd(); expected.setHandicapGroupSet(handicapGroupSetDomainEntity); expected.setCompetitionGroupSet(competitionGroupSetDomainEntity); when(handicapGroupSetService.getById(TestConstants.HANDICAP_GROUP_SET_ID)) .thenReturn(handicapGroupSetDomainEntity); when(competitionGroupSetService.getById(TestConstants.COMPETITION_GROUP_SET_ID)) .thenReturn(competitionGroupSetDomainEntity); EventAddPayload actual = mapper.toDomainAddPayload(apiAddRequest); assertThat(actual).isEqualTo(expected); }
@Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) public abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest);
EventMapper { @Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) public abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest); }
EventMapper { @Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) public abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest);  }
EventMapper { @Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) public abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest);  @Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest); @Mappings({ @Mapping(source = "domainEntity.handicapGroupSet.id", target = "handicapGroupSetId"), @Mapping(source = "domainEntity.competitionGroupSet.id", target = "competitionGroupSetId") }) abstract EventApiEntity toApiEntity(Event domainEntity); abstract List<EventApiEntity> toApiEntityList(List<Event> domainEntityList); abstract EventHibernateEntity toHibernateEntity(EventAddPayload domainAddPayload); EventHibernateEntity toHibernateEntity(Event domainEntity); abstract void updateHibernateEntity(
            Event domainEntity,
            @MappingTarget EventHibernateEntity hibernateEntity
    ); abstract Event toDomainEntity(EventHibernateEntity hibernateEntity); abstract List<Event> toDomainEntityList(List<EventHibernateEntity> hibernateEntityList); HandicapGroupSet toDomainHandicapGroupSet(String handicapGroupSetId); CompetitionGroupSet toDomainCompetitionGroupSet(String competitionGroupSetId); HandicapGroupSetHibernateEntity toHibernateEntity(HandicapGroupSet domainEntity); CompetitionGroupSetHibernateEntity toHibernateEntity(CompetitionGroupSet domainEntity); HandicapGroupSet toDomainEntity(HandicapGroupSetHibernateEntity hibernateEntity); CompetitionGroupSet toDomainEntity(CompetitionGroupSetHibernateEntity hibernateEntity); void setDao(EventDao dao); void setHandicapGroupSetMapper(HandicapGroupSetMapper handicapGroupSetMapper); void setHandicapGroupSetService(HandicapGroupSetService handicapGroupSetService); void setCompetitionGroupSetMapper(CompetitionGroupSetMapper competitionGroupSetMapper); void setCompetitionGroupSetService(CompetitionGroupSetService competitionGroupSetService); }
EventMapper { @Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) public abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest);  @Mappings({ @Mapping(source = "apiAddRequest.handicapGroupSetId", target = "handicapGroupSet"), @Mapping(source = "apiAddRequest.competitionGroupSetId", target = "competitionGroupSet") }) abstract EventAddPayload toDomainAddPayload(AddEventRequest apiAddRequest); @Mappings({ @Mapping(source = "domainEntity.handicapGroupSet.id", target = "handicapGroupSetId"), @Mapping(source = "domainEntity.competitionGroupSet.id", target = "competitionGroupSetId") }) abstract EventApiEntity toApiEntity(Event domainEntity); abstract List<EventApiEntity> toApiEntityList(List<Event> domainEntityList); abstract EventHibernateEntity toHibernateEntity(EventAddPayload domainAddPayload); EventHibernateEntity toHibernateEntity(Event domainEntity); abstract void updateHibernateEntity(
            Event domainEntity,
            @MappingTarget EventHibernateEntity hibernateEntity
    ); abstract Event toDomainEntity(EventHibernateEntity hibernateEntity); abstract List<Event> toDomainEntityList(List<EventHibernateEntity> hibernateEntityList); HandicapGroupSet toDomainHandicapGroupSet(String handicapGroupSetId); CompetitionGroupSet toDomainCompetitionGroupSet(String competitionGroupSetId); HandicapGroupSetHibernateEntity toHibernateEntity(HandicapGroupSet domainEntity); CompetitionGroupSetHibernateEntity toHibernateEntity(CompetitionGroupSet domainEntity); HandicapGroupSet toDomainEntity(HandicapGroupSetHibernateEntity hibernateEntity); CompetitionGroupSet toDomainEntity(CompetitionGroupSetHibernateEntity hibernateEntity); void setDao(EventDao dao); void setHandicapGroupSetMapper(HandicapGroupSetMapper handicapGroupSetMapper); void setHandicapGroupSetService(HandicapGroupSetService handicapGroupSetService); void setCompetitionGroupSetMapper(CompetitionGroupSetMapper competitionGroupSetMapper); void setCompetitionGroupSetService(CompetitionGroupSetService competitionGroupSetService);  }