From 909312a8a1584c9c7754a5b9a1c7abea6512207e Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 27 Oct 2022 11:45:53 +0200 Subject: [PATCH] test class naming convention --- .../net/hostsharing/hsadminng/arch/ArchitectureTest.java | 8 ++++++++ ...a => HsOfficeCoopAssetsTransactionEntityUnitTest.java} | 2 +- ...a => HsOfficeCoopSharesTransactionEntityUnitTest.java} | 2 +- ...EntityTest.java => HsOfficeDebitorEntityUnitTest.java} | 2 +- ...est.java => HsOfficePartnerDetailsEntityUnitTest.java} | 2 +- ...EntityTest.java => HsOfficePartnerEntityUnitTest.java} | 2 +- ...tyTest.java => HsOfficeSepaMandateEntityUnitTest.java} | 2 +- 7 files changed, 14 insertions(+), 6 deletions(-) rename src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/{HsOfficeCoopAssetsTransactionEntityTest.java => HsOfficeCoopAssetsTransactionEntityUnitTest.java} (95%) rename src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/{HsOfficeCoopSharesTransactionEntityTest.java => HsOfficeCoopSharesTransactionEntityUnitTest.java} (95%) rename src/test/java/net/hostsharing/hsadminng/hs/office/debitor/{HsOfficeDebitorEntityTest.java => HsOfficeDebitorEntityUnitTest.java} (97%) rename src/test/java/net/hostsharing/hsadminng/hs/office/partner/{HsOfficePartnerDetailsEntityTest.java => HsOfficePartnerDetailsEntityUnitTest.java} (97%) rename src/test/java/net/hostsharing/hsadminng/hs/office/partner/{HsOfficePartnerEntityTest.java => HsOfficePartnerEntityUnitTest.java} (96%) rename src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/{HsOfficeSepaMandateEntityTest.java => HsOfficeSepaMandateEntityUnitTest.java} (96%) diff --git a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java index ff3a9eaa..e6ac9b99 100644 --- a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java +++ b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.web.bind.annotation.RestController; +import static com.tngtech.archunit.core.domain.JavaModifier.*; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.*; import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices; @@ -61,6 +62,13 @@ public class ArchitectureTest { public static final ArchRule dontUseImplSuffix = noClasses() .should().haveSimpleNameEndingWith("Impl"); + @ArchTest + @SuppressWarnings("unused") + public static final ArchRule testClassesAreProperlyNamed = classes() + .that().haveSimpleNameEndingWith("Test") + .and().doNotHaveModifier(ABSTRACT) + .should().haveNameMatching(".*(UnitTest|RestTest|IntegrationTest|AcceptanceTest|ArchitectureTest)$"); + @ArchTest @SuppressWarnings("unused") public static final ArchRule allPackagesBelowNetHostsharingHsAdmin = noClasses() diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java similarity index 95% rename from src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java index b8c220d4..7be6ec0b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java @@ -8,7 +8,7 @@ import java.time.LocalDate; import static net.hostsharing.hsadminng.hs.office.membership.TestHsMembership.TEST_MEMBERSHIP; import static org.assertj.core.api.Assertions.assertThat; -class HsOfficeCoopAssetsTransactionEntityTest { +class HsOfficeCoopAssetsTransactionEntityUnitTest { final HsOfficeCoopAssetsTransactionEntity givenCoopAssetTransaction = HsOfficeCoopAssetsTransactionEntity.builder() .membership(TEST_MEMBERSHIP) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java similarity index 95% rename from src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java index a12e30c9..fc0df074 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java @@ -7,7 +7,7 @@ import java.time.LocalDate; import static net.hostsharing.hsadminng.hs.office.membership.TestHsMembership.TEST_MEMBERSHIP; import static org.assertj.core.api.Assertions.assertThat; -class HsOfficeCoopSharesTransactionEntityTest { +class HsOfficeCoopSharesTransactionEntityUnitTest { final HsOfficeCoopSharesTransactionEntity givenCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder() .membership(TEST_MEMBERSHIP) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java similarity index 97% rename from src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java index 5be98ecc..0f147f93 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; -class HsOfficeDebitorEntityTest { +class HsOfficeDebitorEntityUnitTest { @Test void toStringContainsPartnerAndContact() { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityUnitTest.java similarity index 97% rename from src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityUnitTest.java index cccc39d3..24228031 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityUnitTest.java @@ -6,7 +6,7 @@ import java.time.LocalDate; import static org.assertj.core.api.Assertions.assertThat; -class HsOfficePartnerDetailsEntityTest { +class HsOfficePartnerDetailsEntityUnitTest { final HsOfficePartnerDetailsEntity given = HsOfficePartnerDetailsEntity.builder() .registrationOffice("Hamburg") diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java similarity index 96% rename from src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java index c28d76d2..a0ad4c46 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; -class HsOfficePartnerEntityTest { +class HsOfficePartnerEntityUnitTest { @Test void toStringContainsPersonAndContact() { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityUnitTest.java similarity index 96% rename from src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityUnitTest.java index 4ef2aed2..02dee978 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityUnitTest.java @@ -9,7 +9,7 @@ import java.time.LocalDate; import static net.hostsharing.hsadminng.hs.office.debitor.TestHsOfficeDebitor.TEST_DEBITOR; import static org.assertj.core.api.Assertions.assertThat; -class HsOfficeSepaMandateEntityTest { +class HsOfficeSepaMandateEntityUnitTest { final HsOfficeSepaMandateEntity givenSepaMandate = HsOfficeSepaMandateEntity.builder() .debitor(TEST_DEBITOR)