test class naming convention

This commit is contained in:
Michael Hoennig 2022-10-27 11:45:53 +02:00
parent dc1a17e915
commit 909312a8a1
7 changed files with 14 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.web.bind.annotation.RestController; 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.lang.syntax.ArchRuleDefinition.*;
import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices; import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices;
@ -61,6 +62,13 @@ public class ArchitectureTest {
public static final ArchRule dontUseImplSuffix = noClasses() public static final ArchRule dontUseImplSuffix = noClasses()
.should().haveSimpleNameEndingWith("Impl"); .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 @ArchTest
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static final ArchRule allPackagesBelowNetHostsharingHsAdmin = noClasses() public static final ArchRule allPackagesBelowNetHostsharingHsAdmin = noClasses()

View File

@ -8,7 +8,7 @@ import java.time.LocalDate;
import static net.hostsharing.hsadminng.hs.office.membership.TestHsMembership.TEST_MEMBERSHIP; import static net.hostsharing.hsadminng.hs.office.membership.TestHsMembership.TEST_MEMBERSHIP;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class HsOfficeCoopAssetsTransactionEntityTest { class HsOfficeCoopAssetsTransactionEntityUnitTest {
final HsOfficeCoopAssetsTransactionEntity givenCoopAssetTransaction = HsOfficeCoopAssetsTransactionEntity.builder() final HsOfficeCoopAssetsTransactionEntity givenCoopAssetTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
.membership(TEST_MEMBERSHIP) .membership(TEST_MEMBERSHIP)

View File

@ -7,7 +7,7 @@ import java.time.LocalDate;
import static net.hostsharing.hsadminng.hs.office.membership.TestHsMembership.TEST_MEMBERSHIP; import static net.hostsharing.hsadminng.hs.office.membership.TestHsMembership.TEST_MEMBERSHIP;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class HsOfficeCoopSharesTransactionEntityTest { class HsOfficeCoopSharesTransactionEntityUnitTest {
final HsOfficeCoopSharesTransactionEntity givenCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder() final HsOfficeCoopSharesTransactionEntity givenCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder()
.membership(TEST_MEMBERSHIP) .membership(TEST_MEMBERSHIP)

View File

@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class HsOfficeDebitorEntityTest { class HsOfficeDebitorEntityUnitTest {
@Test @Test
void toStringContainsPartnerAndContact() { void toStringContainsPartnerAndContact() {

View File

@ -6,7 +6,7 @@ import java.time.LocalDate;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class HsOfficePartnerDetailsEntityTest { class HsOfficePartnerDetailsEntityUnitTest {
final HsOfficePartnerDetailsEntity given = HsOfficePartnerDetailsEntity.builder() final HsOfficePartnerDetailsEntity given = HsOfficePartnerDetailsEntity.builder()
.registrationOffice("Hamburg") .registrationOffice("Hamburg")

View File

@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class HsOfficePartnerEntityTest { class HsOfficePartnerEntityUnitTest {
@Test @Test
void toStringContainsPersonAndContact() { void toStringContainsPersonAndContact() {

View File

@ -9,7 +9,7 @@ import java.time.LocalDate;
import static net.hostsharing.hsadminng.hs.office.debitor.TestHsOfficeDebitor.TEST_DEBITOR; import static net.hostsharing.hsadminng.hs.office.debitor.TestHsOfficeDebitor.TEST_DEBITOR;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class HsOfficeSepaMandateEntityTest { class HsOfficeSepaMandateEntityUnitTest {
final HsOfficeSepaMandateEntity givenSepaMandate = HsOfficeSepaMandateEntity.builder() final HsOfficeSepaMandateEntity givenSepaMandate = HsOfficeSepaMandateEntity.builder()
.debitor(TEST_DEBITOR) .debitor(TEST_DEBITOR)