Skip to content

Commit 73c0af2

Browse files
committed
Move architecture tests to a dedicated package
1 parent 0e2ea1a commit 73c0af2

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

.github/workflows/quality-monitor-pit.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ jobs:
5656
"tools": [
5757
{
5858
"id": "junit",
59-
"name": "JUnit Tests",
60-
"pattern": "**/target/*-reports/TEST*.xml"
59+
"name": "Unit Tests",
60+
"pattern": "**/target/*-reports/TEST*util*.xml"
61+
},
62+
{
63+
"id": "junit",
64+
"icon": "no_entry",
65+
"name": "Architecture tests",
66+
"pattern": "**/target/surefire-reports/TEST*archunit*.xml"
6167
}
6268
]
6369
},

src/test/java/edu/hm/hafner/util/ArchitectureRules.java renamed to src/test/java/edu/hm/hafner/archunit/ArchitectureRules.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
package edu.hm.hafner.util;
2-
3-
import java.io.Serializable;
4-
import java.util.List;
1+
package edu.hm.hafner.archunit;
52

63
import org.junit.jupiter.api.Test;
74
import org.junit.jupiter.params.ParameterizedTest;
@@ -19,6 +16,11 @@
1916
import com.tngtech.archunit.lang.ConditionEvents;
2017
import com.tngtech.archunit.lang.SimpleConditionEvent;
2118

19+
import edu.hm.hafner.util.VisibleForTesting;
20+
21+
import java.io.Serializable;
22+
import java.util.List;
23+
2224
import static com.tngtech.archunit.core.domain.JavaAccess.Predicates.*;
2325
import static com.tngtech.archunit.lang.conditions.ArchConditions.*;
2426
import static com.tngtech.archunit.lang.conditions.ArchPredicates.*;

src/test/java/edu/hm/hafner/util/ArchitectureRulesTest.java renamed to src/test/java/edu/hm/hafner/archunit/ArchitectureRulesTest.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
package edu.hm.hafner.util;
1+
package edu.hm.hafner.archunit;
22

33
import org.junit.jupiter.api.Disabled;
44
import org.junit.jupiter.api.Test;
55

66
import com.tngtech.archunit.core.domain.JavaClasses;
77
import com.tngtech.archunit.core.importer.ClassFileImporter;
88

9+
import edu.hm.hafner.util.Generated;
910
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1011

1112
import java.io.Serializable;
@@ -25,9 +26,9 @@ void shouldUseProtectedForReadResolve() {
2526
assertThatExceptionOfType(AssertionError.class).isThrownBy(
2627
() -> ArchitectureRules.READ_RESOLVE_SHOULD_BE_PROTECTED.check(importBrokenClass()))
2728
.withMessageContainingAll(BROKEN_CLASS_NAME, "was violated (3 times)",
28-
"Method <edu.hm.hafner.util.ArchitectureRulesTest$ArchitectureRulesAlsoViolatedTest.readResolve()> is not protected but the class might be extended in (ArchitectureRulesTest.java:",
29-
"Method <edu.hm.hafner.util.ArchitectureRulesTest$ArchitectureRulesViolatedTest.readResolve()> is not declared in classes that implement java.io.Serializable in (ArchitectureRulesTest.java:",
30-
"Method <edu.hm.hafner.util.ArchitectureRulesTest$ArchitectureRulesViolatedTest.readResolve()> is not protected but the class might be extended in (ArchitectureRulesTest.java:");
29+
"Method <edu.hm.hafner.archunit.ArchitectureRulesTest$ArchitectureRulesAlsoViolatedTest.readResolve()> is not protected but the class might be extended in (ArchitectureRulesTest.java:",
30+
"Method <edu.hm.hafner.archunit.ArchitectureRulesTest$ArchitectureRulesViolatedTest.readResolve()> is not declared in classes that implement java.io.Serializable in (ArchitectureRulesTest.java:",
31+
"Method <edu.hm.hafner.archunit.ArchitectureRulesTest$ArchitectureRulesViolatedTest.readResolve()> is not protected but the class might be extended in (ArchitectureRulesTest.java:");
3132

3233
assertThatNoException().isThrownBy(
3334
() -> ArchitectureRules.READ_RESOLVE_SHOULD_BE_PROTECTED.check(importPassingClass()));
@@ -39,9 +40,9 @@ void shouldNotUseJsr305Annotations() {
3940
() -> ArchitectureRules.NO_FORBIDDEN_ANNOTATION_USED.check(
4041
importClasses(ArchitectureRulesViolatedTest.class)))
4142
.withMessageContainingAll("was violated (3 times)", "edu.umd.cs.findbugs.annotations",
42-
"Field <edu.hm.hafner.util.ArchitectureRulesTest$ArchitectureRulesViolatedTest.noNullable> is annotated with <edu.umd.cs.findbugs.annotations.Nullable>",
43-
"Method <edu.hm.hafner.util.ArchitectureRulesTest$ArchitectureRulesViolatedTest.method(java.lang.String)> is annotated with <edu.umd.cs.findbugs.annotations.Nullable>",
44-
"Parameter <java.lang.String> of method <edu.hm.hafner.util.ArchitectureRulesTest$ArchitectureRulesViolatedTest.method(java.lang.String)> is annotated with <edu.umd.cs.findbugs.annotations.Nullable>");
43+
"Field <edu.hm.hafner.archunit.ArchitectureRulesTest$ArchitectureRulesViolatedTest.noNullable> is annotated with <edu.umd.cs.findbugs.annotations.Nullable>",
44+
"Method <edu.hm.hafner.archunit.ArchitectureRulesTest$ArchitectureRulesViolatedTest.method(java.lang.String)> is annotated with <edu.umd.cs.findbugs.annotations.Nullable>",
45+
"Parameter <java.lang.String> of method <edu.hm.hafner.archunit.ArchitectureRulesTest$ArchitectureRulesViolatedTest.method(java.lang.String)> is annotated with <edu.umd.cs.findbugs.annotations.Nullable>");
4546

4647
assertThatNoException().isThrownBy(
4748
() -> ArchitectureRules.NO_FORBIDDEN_ANNOTATION_USED.check(importPassingClass()));

src/test/java/edu/hm/hafner/util/ArchitectureTest.java renamed to src/test/java/edu/hm/hafner/archunit/ArchitectureTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package edu.hm.hafner.util;
1+
package edu.hm.hafner.archunit;
22

33
import com.tngtech.archunit.core.importer.ImportOption;
44
import com.tngtech.archunit.core.importer.Location;
55
import com.tngtech.archunit.junit.AnalyzeClasses;
66
import com.tngtech.archunit.junit.ArchTest;
77
import com.tngtech.archunit.lang.ArchRule;
88

9-
import edu.hm.hafner.util.ArchitectureTest.DoNotIncludeRulesUnderTest;
9+
import edu.hm.hafner.archunit.ArchitectureTest.DoNotIncludeRulesUnderTest;
1010

1111
/**
1212
* Checks the architecture of this module.

src/test/java/edu/hm/hafner/util/PackageArchitectureTest.java renamed to src/test/java/edu/hm/hafner/archunit/PackageArchitectureTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package edu.hm.hafner.util;
2-
3-
import java.net.URL;
4-
import java.util.Objects;
1+
package edu.hm.hafner.archunit;
52

63
import com.tngtech.archunit.core.importer.ImportOption.DoNotIncludeTests;
74
import com.tngtech.archunit.junit.AnalyzeClasses;
85
import com.tngtech.archunit.junit.ArchTest;
96
import com.tngtech.archunit.lang.ArchRule;
107

8+
import java.net.URL;
9+
import java.util.Objects;
10+
1111
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.*;
1212
import static com.tngtech.archunit.library.plantuml.rules.PlantUmlArchCondition.Configuration.*;
1313
import static com.tngtech.archunit.library.plantuml.rules.PlantUmlArchCondition.*;

0 commit comments

Comments
 (0)