Skip to content

Commit

Permalink
Include reason for architecture test.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Aug 11, 2022
1 parent 7b2f014 commit 88924e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/java/edu/hm/hafner/util/ArchitectureRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public final class ArchitectureRules {
public static final ArchRule NO_EXCEPTIONS_WITH_NO_ARG_CONSTRUCTOR =
noClasses().that().haveSimpleNameNotContaining("Benchmark")
.should().callConstructorWhere(exceptionHasNoContextAsParameter())
.because("exceptions should include failure-capture information in detail messages (Effective Java Item 75)");
.because("exceptions should include failure-capture information in detail messages (Effective Java Item 75)")
.allowEmptyShould(true);

/** Junit 5 test classes should not be public. */
public static final ArchRule NO_PUBLIC_TEST_CLASSES =
Expand All @@ -54,7 +55,9 @@ public final class ArchitectureRules {
/** ArchUnit tests should not be public. */
public static final ArchRule ONLY_PACKAGE_PRIVATE_ARCHITECTURE_TESTS =
fields().that().areAnnotatedWith(ArchTest.class)
.should().bePackagePrivate();
.should().bePackagePrivate()
.because("architecture tests are not part of the API and should be hidden in a package")
.allowEmptyShould(true);

/**
* Methods or constructors that are annotated with {@link VisibleForTesting} must not be called by other classes.
Expand Down

0 comments on commit 88924e0

Please sign in to comment.