From 8ebbf20b938feef4c22a6cd67290716ff9ae2882 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 25 Sep 2024 16:21:23 +0200 Subject: [PATCH] split StandardMapper and StrictMapper --- .../booking/item/HsBookingItemController.java | 8 +++----- .../project/HsBookingProjectController.java | 4 ++-- .../asset/HsHostingAssetController.java | 4 ++-- .../HsOfficeBankAccountController.java | 4 ++-- .../contact/HsOfficeContactController.java | 4 ++-- ...OfficeCoopAssetsTransactionController.java | 4 ++-- ...OfficeCoopSharesTransactionController.java | 4 ++-- .../debitor/HsOfficeDebitorController.java | 4 ++-- .../HsOfficeMembershipController.java | 4 ++-- .../HsOfficeMembershipEntityPatcher.java | 6 +++--- .../partner/HsOfficePartnerController.java | 4 ++-- .../person/HsOfficePersonController.java | 4 ++-- .../relation/HsOfficeRelationController.java | 4 ++-- .../HsOfficeSepaMandateController.java | 4 ++-- .../hostsharing/hsadminng/mapper/Mapper.java | 15 ++------------- .../hsadminng/mapper/MapperConfiguration.java | 13 ------------- .../hsadminng/mapper/StandardMapper.java | 14 ++++++++++++++ .../hsadminng/mapper/StrictMapper.java | 19 +++++++++++++++++++ .../rbac/grant/RbacGrantController.java | 4 ++-- .../rbac/role/RbacRoleController.java | 4 ++-- .../rbac/subject/RbacSubjectController.java | 4 ++-- .../test/cust/TestCustomerController.java | 4 ++-- .../rbac/test/pac/TestPackageController.java | 4 ++-- .../item/HsBookingItemControllerRestTest.java | 6 +++--- .../HsHostingAssetControllerRestTest.java | 6 +++--- ...HsOfficeBankAccountControllerRestTest.java | 4 ++-- ...opAssetsTransactionControllerRestTest.java | 4 ++-- ...opSharesTransactionControllerRestTest.java | 4 ++-- .../HsOfficeMembershipControllerRestTest.java | 4 ++-- ...OfficeMembershipEntityPatcherUnitTest.java | 4 ++-- .../HsOfficePartnerControllerRestTest.java | 4 ++-- .../rbac/context/ContextIntegrationTests.java | 4 ++-- .../rbac/role/RbacRoleControllerRestTest.java | 4 ++-- .../RbacSubjectControllerRestTest.java | 4 ++-- .../hsadminng/rbac/test/MapperUnitTest.java | 4 ++-- 35 files changed, 101 insertions(+), 94 deletions(-) delete mode 100644 src/main/java/net/hostsharing/hsadminng/mapper/MapperConfiguration.java create mode 100644 src/main/java/net/hostsharing/hsadminng/mapper/StandardMapper.java create mode 100644 src/main/java/net/hostsharing/hsadminng/mapper/StrictMapper.java diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java index e8e01b87..84f35054 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java @@ -9,7 +9,7 @@ import net.hostsharing.hsadminng.hs.booking.item.validators.BookingItemEntitySav import net.hostsharing.hsadminng.hs.booking.item.validators.HsBookingItemEntityValidatorRegistry; import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectRealEntity; import net.hostsharing.hsadminng.mapper.KeyValueMap; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -23,7 +23,6 @@ import java.util.UUID; import java.util.function.BiConsumer; import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange; -import static org.modelmapper.convention.MatchingStrategies.STRICT; @RestController public class HsBookingItemController implements HsBookingItemsApi { @@ -32,7 +31,7 @@ public class HsBookingItemController implements HsBookingItemsApi { private Context context; @Autowired - private Mapper mapper; + private StrictMapper mapper; @Autowired private HsBookingItemRbacRepository bookingItemRepo; @@ -63,8 +62,7 @@ public class HsBookingItemController implements HsBookingItemsApi { context.define(currentSubject, assumedRoles); - final var entityToSave = mapper.withMatchingStrategy(STRICT) - .map(body, HsBookingItemRbacEntity.class, RESOURCE_TO_ENTITY_POSTMAPPER); + final var entityToSave = mapper.map(body, HsBookingItemRbacEntity.class, RESOURCE_TO_ENTITY_POSTMAPPER); final var mapped = new BookingItemEntitySaveProcessor(em, entityToSave) .preprocessEntity() .validateEntity() diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java index 55d26b36..f657d45e 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java @@ -6,7 +6,7 @@ import net.hostsharing.hsadminng.hs.booking.generated.api.v1.api.HsBookingProjec import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingProjectInsertResource; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingProjectPatchResource; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingProjectResource; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; @@ -25,7 +25,7 @@ public class HsBookingProjectController implements HsBookingProjectsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsBookingProjectRbacRepository bookingProjectRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java index 8973d0cc..56b59427 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java @@ -11,7 +11,7 @@ import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAsse import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetResource; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetTypeResource; import net.hostsharing.hsadminng.mapper.KeyValueMap; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -35,7 +35,7 @@ public class HsHostingAssetController implements HsHostingAssetsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsHostingAssetRbacRepository rbacAssetRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java index 50183bf7..69295853 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java @@ -4,7 +4,7 @@ import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeBankAccountsApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeBankAccountInsertResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeBankAccountResource; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.iban4j.BicUtil; import org.iban4j.IbanUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -24,7 +24,7 @@ public class HsOfficeBankAccountController implements HsOfficeBankAccountsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeBankAccountRepository bankAccountRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java index 17d39b7f..0f94e858 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactController.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.hs.office.contact; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeContactsApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeContactInsertResource; @@ -26,7 +26,7 @@ public class HsOfficeContactController implements HsOfficeContactsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeContactRbacRepository contactRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java index f4cb28a3..9154b8f0 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java @@ -4,7 +4,7 @@ import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopAssetsApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*; import net.hostsharing.hsadminng.errors.MultiValidationException; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat.ISO; @@ -29,7 +29,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeCoopAssetsTransactionRepository coopAssetsTransactionRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java index 1616568d..6712fefd 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java @@ -6,7 +6,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopShar import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionInsertResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionResource; import net.hostsharing.hsadminng.errors.MultiValidationException; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat.ISO; @@ -31,7 +31,7 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeCoopSharesTransactionRepository coopSharesTransactionRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java index fd8412c8..a2466aa9 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java @@ -7,7 +7,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebito import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorResource; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.object.BaseEntity; import org.apache.commons.lang3.Validate; import org.hibernate.Hibernate; @@ -34,7 +34,7 @@ public class HsOfficeDebitorController implements HsOfficeDebitorsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeDebitorRepository debitorRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java index 8c87e5fa..d63f9e6a 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeMembersh import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipInsertResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipResource; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; @@ -24,7 +24,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeMembershipRepository membershipRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcher.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcher.java index cbecb800..33bf363b 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcher.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcher.java @@ -2,18 +2,18 @@ package net.hostsharing.hsadminng.hs.office.membership; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource; import net.hostsharing.hsadminng.mapper.EntityPatcher; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.mapper.OptionalFromJson; import java.util.Optional; public class HsOfficeMembershipEntityPatcher implements EntityPatcher { - private final Mapper mapper; + private final StandardMapper mapper; private final HsOfficeMembershipEntity entity; public HsOfficeMembershipEntityPatcher( - final Mapper mapper, + final StandardMapper mapper, final HsOfficeMembershipEntity entity) { this.mapper = mapper; this.entity = entity; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerController.java index b4b8bd75..55c280f3 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerController.java @@ -12,7 +12,7 @@ import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.object.BaseEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -36,7 +36,7 @@ public class HsOfficePartnerController implements HsOfficePartnersApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficePartnerRepository partnerRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonController.java index 41d9d441..ac746aab 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonController.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.hs.office.person; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficePersonsApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePersonInsertResource; @@ -23,7 +23,7 @@ public class HsOfficePersonController implements HsOfficePersonsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficePersonRepository personRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java index f054e563..b93537d9 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeRelationsApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; @@ -28,7 +28,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeRelationRbacRepository relationRbacRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateController.java index 9511bdd6..52ef2aad 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateController.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeSepaMand import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeSepaMandateInsertResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeSepaMandatePatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeSepaMandateResource; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; @@ -28,7 +28,7 @@ public class HsOfficeSepaMandateController implements HsOfficeSepaMandatesApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private HsOfficeSepaMandateRepository sepaMandateRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/mapper/Mapper.java b/src/main/java/net/hostsharing/hsadminng/mapper/Mapper.java index a8355aaf..b568a0e6 100644 --- a/src/main/java/net/hostsharing/hsadminng/mapper/Mapper.java +++ b/src/main/java/net/hostsharing/hsadminng/mapper/Mapper.java @@ -1,7 +1,6 @@ package net.hostsharing.hsadminng.mapper; import org.modelmapper.ModelMapper; -import org.modelmapper.spi.MatchingStrategy; import org.springframework.util.ReflectionUtils; import jakarta.persistence.EntityManager; @@ -20,25 +19,15 @@ import static net.hostsharing.hsadminng.errors.DisplayAs.DisplayName; /** * A nicer API for ModelMapper. */ -public class Mapper extends ModelMapper { +abstract class Mapper extends ModelMapper { @PersistenceContext EntityManager em; - public Mapper() { + Mapper() { getConfiguration().setAmbiguityIgnored(true); } - /** Use STRICT to make sure that resource.whateverUuid does not accidentally get mapped to entity.uuid, - * if resource.uuid does not exist - * - * @return this - */ - public Mapper withMatchingStrategy(final MatchingStrategy matchingStrategy) { - getConfiguration().setMatchingStrategy(matchingStrategy); - return this; - } - public List mapList(final List source, final Class targetClass) { return mapList(source, targetClass, null); } diff --git a/src/main/java/net/hostsharing/hsadminng/mapper/MapperConfiguration.java b/src/main/java/net/hostsharing/hsadminng/mapper/MapperConfiguration.java deleted file mode 100644 index a77b953a..00000000 --- a/src/main/java/net/hostsharing/hsadminng/mapper/MapperConfiguration.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.hostsharing.hsadminng.mapper; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class MapperConfiguration { - - @Bean - public Mapper modelMapper() { - return new Mapper(); - } -} diff --git a/src/main/java/net/hostsharing/hsadminng/mapper/StandardMapper.java b/src/main/java/net/hostsharing/hsadminng/mapper/StandardMapper.java new file mode 100644 index 00000000..42725d3d --- /dev/null +++ b/src/main/java/net/hostsharing/hsadminng/mapper/StandardMapper.java @@ -0,0 +1,14 @@ +package net.hostsharing.hsadminng.mapper; + +import org.springframework.stereotype.Component; + +/** + * A nicer API for ModelMapper in standard mode. + */ +@Component +public class StandardMapper extends Mapper { + + public StandardMapper() { + getConfiguration().setAmbiguityIgnored(true); + } +} diff --git a/src/main/java/net/hostsharing/hsadminng/mapper/StrictMapper.java b/src/main/java/net/hostsharing/hsadminng/mapper/StrictMapper.java new file mode 100644 index 00000000..a6d3c3fc --- /dev/null +++ b/src/main/java/net/hostsharing/hsadminng/mapper/StrictMapper.java @@ -0,0 +1,19 @@ +package net.hostsharing.hsadminng.mapper; + +import org.springframework.stereotype.Component; + +import static org.modelmapper.convention.MatchingStrategies.STRICT; + +/** + * A nicer API for ModelMapper in strict mode. + * + *

This makes sure that resource.whateverUuid does not accidentally get mapped to entity.uuid, + * if resource.uuid does not exist.

+ */ +@Component +public class StrictMapper extends Mapper { + + public StrictMapper() { + getConfiguration().setMatchingStrategy(STRICT); + } +} diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java index 4ca538b9..6af53104 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.grant; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.generated.api.v1.api.RbacGrantsApi; import net.hostsharing.hsadminng.rbac.generated.api.v1.model.RbacGrantResource; import org.springframework.beans.factory.annotation.Autowired; @@ -22,7 +22,7 @@ public class RbacGrantController implements RbacGrantsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private RbacGrantRepository rbacGrantRepository; diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleController.java b/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleController.java index 5da97292..cffff888 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleController.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.role; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.generated.api.v1.api.RbacRolesApi; import net.hostsharing.hsadminng.rbac.generated.api.v1.model.RbacRoleResource; import org.springframework.beans.factory.annotation.Autowired; @@ -18,7 +18,7 @@ public class RbacRoleController implements RbacRolesApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private RbacRoleRepository rbacRoleRepository; diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java b/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java index 52c0649b..1676cc7c 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.subject; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.generated.api.v1.api.RbacSubjectsApi; import net.hostsharing.hsadminng.rbac.generated.api.v1.model.RbacSubjectPermissionResource; import net.hostsharing.hsadminng.rbac.generated.api.v1.model.RbacSubjectResource; @@ -21,7 +21,7 @@ public class RbacSubjectController implements RbacSubjectsApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private RbacSubjectRepository rbacSubjectRepository; diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java index c6bbc115..26628545 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.test.cust; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.test.generated.api.v1.api.TestCustomersApi; import net.hostsharing.hsadminng.test.generated.api.v1.model.TestCustomerResource; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +21,7 @@ public class TestCustomerController implements TestCustomersApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private TestCustomerRepository testCustomerRepository; diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java index c6ecc7e0..d503bf58 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.rbac.test.pac; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.mapper.OptionalFromJson; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.test.generated.api.v1.api.TestPackagesApi; @@ -21,7 +21,7 @@ public class TestPackageController implements TestPackagesApi { private Context context; @Autowired - private Mapper mapper; + private StandardMapper mapper; @Autowired private TestPackageRepository testPackageRepository; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java index 4e21df03..11ecf5bc 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java @@ -4,7 +4,7 @@ import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectRealEntity; import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectRealRepository; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -38,7 +38,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(HsBookingItemController.class) -@Import({Mapper.class, JsonObjectMapperConfiguration.class}) +@Import({StrictMapper.class, JsonObjectMapperConfiguration.class}) @RunWith(SpringRunner.class) class HsBookingItemControllerRestTest { @@ -50,7 +50,7 @@ class HsBookingItemControllerRestTest { @Autowired @SuppressWarnings("unused") // not used in test, but in controller class - Mapper mapper; + StrictMapper mapper; @MockBean EntityManagerWrapper em; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java index b2726f48..9dc5741b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java @@ -9,7 +9,7 @@ import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemRealRepository; import net.hostsharing.hsadminng.mapper.Array; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -52,7 +52,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(HsHostingAssetController.class) -@Import({Mapper.class, JsonObjectMapperConfiguration.class}) +@Import({ StandardMapper.class, JsonObjectMapperConfiguration.class}) @RunWith(SpringRunner.class) public class HsHostingAssetControllerRestTest { @@ -64,7 +64,7 @@ public class HsHostingAssetControllerRestTest { @Autowired @SuppressWarnings("unused") // not used in test, but in controller class - Mapper mapper; + StandardMapper mapper; @MockBean EntityManagerWrapper em; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java index 6dcd1cb5..624e9994 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.bankaccount; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.springframework.beans.factory.annotation.Autowired; @@ -25,7 +25,7 @@ class HsOfficeBankAccountControllerRestTest { Context contextMock; @MockBean - Mapper mapper; + StandardMapper mapper; @MockBean HsOfficeBankAccountRepository bankAccountRepo; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java index 0e4716d4..03a1c71b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.coopassets; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.test.JsonBuilder; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; @@ -30,7 +30,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest { Context contextMock; @MockBean - Mapper mapper; + StandardMapper mapper; @MockBean HsOfficeCoopAssetsTransactionRepository coopAssetsTransactionRepo; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java index 4d44c0fb..1e33fde9 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.coopshares; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.test.JsonBuilder; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; @@ -30,7 +30,7 @@ class HsOfficeCoopSharesTransactionControllerRestTest { Context contextMock; @MockBean - Mapper mapper; + StandardMapper mapper; @MockBean HsOfficeCoopSharesTransactionRepository coopSharesTransactionRepo; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java index 2a5005e6..c26024fd 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.membership; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionRepository; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -32,7 +32,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(HsOfficeMembershipController.class) -@Import(Mapper.class) +@Import(StandardMapper.class) public class HsOfficeMembershipControllerRestTest { @Autowired diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java index 2e739e7f..841e7e12 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java @@ -4,7 +4,7 @@ import io.hypersistence.utils.hibernate.type.range.Range; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipStatusResource; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; @@ -40,7 +40,7 @@ class HsOfficeMembershipEntityPatcherUnitTest extends PatchUnitTestBase< @Mock private EntityManager em; - private Mapper mapper = new Mapper(); + private StandardMapper mapper = new StandardMapper(); @BeforeEach void initMocks() { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java index a42a4780..2af222dc 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(HsOfficePartnerController.class) -@Import(Mapper.class) +@Import(StandardMapper.class) class HsOfficePartnerControllerRestTest { static final UUID GIVEN_MANDANTE_UUID = UUID.randomUUID(); diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java index c48f782e..cf5f387e 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.context; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.mapper.Array; import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Test; @@ -17,7 +17,7 @@ import jakarta.servlet.http.HttpServletRequest; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest -@ComponentScan(basePackageClasses = { Context.class, JpaAttempt.class, Mapper.class }) +@ComponentScan(basePackageClasses = { Context.class, JpaAttempt.class, StandardMapper.class }) @DirtiesContext class ContextIntegrationTests { diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/role/RbacRoleControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/role/RbacRoleControllerRestTest.java index 2d3d74c7..7d38b0e9 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/role/RbacRoleControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/role/RbacRoleControllerRestTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.role; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; @@ -30,7 +30,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(RbacRoleController.class) -@Import(Mapper.class) +@Import(StandardMapper.class) @RunWith(SpringRunner.class) class RbacRoleControllerRestTest { diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java index d23a8394..2131c7d9 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.rbac.subject; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; @@ -31,7 +31,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(RbacSubjectController.class) -@Import(Mapper.class) +@Import(StandardMapper.class) @RunWith(SpringRunner.class) class RbacSubjectControllerRestTest { diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java index 0e01cd05..c2721246 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.rbac.test; import lombok.*; import net.hostsharing.hsadminng.errors.DisplayAs; -import net.hostsharing.hsadminng.mapper.Mapper; +import net.hostsharing.hsadminng.mapper.StandardMapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -27,7 +27,7 @@ class MapperUnitTest { EntityManager em; @InjectMocks - Mapper mapper; + StandardMapper mapper; final UUID GIVEN_UUID = UUID.randomUUID();