From 123172c00c3ce5c8f7716566e30accede306cef7 Mon Sep 17 00:00:00 2001 From: Andreas Hufler Date: Fri, 16 Jan 2026 13:50:07 +0100 Subject: [PATCH 1/2] blacklist some methods --- lombok.config | 9 +++++++++ .../archunit/toolbox/ArchitectureTestBase.java | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 lombok.config diff --git a/lombok.config b/lombok.config new file mode 100644 index 0000000..5ffcbcb --- /dev/null +++ b/lombok.config @@ -0,0 +1,9 @@ +config.stopBubbling = true + +# Required for NullAway to work +lombok.addLombokGeneratedAnnotation = true + +# Copy JSpecify annotations to generated code (constructors, getters, setters) +lombok.copyableAnnotations += org.jspecify.annotations.Nullable +lombok.copyableAnnotations += org.jspecify.annotations.NonNull +lombok.addNullAnnotations = jspecify diff --git a/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java b/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java index 05c4e63..84286cd 100644 --- a/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java +++ b/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java @@ -28,6 +28,17 @@ public abstract class ArchitectureTestBase { Set.of( // We should use `assertThatExceptionOfType(...).isThrownBy(...)` instead of `assertThatThrownBy(...)` "org.assertj.core.api.Assertions.assertThatThrownBy", + "org.junit.jupiter.api.Assertions.assertThrows", + "org.junit.jupiter.api.Assertions.assertDoesNotThrow", + "org.junit.jupiter.api.Assertions.assertTrue", + "org.junit.jupiter.api.Assertions.assertFalse", + "org.junit.jupiter.api.Assertions.assertEquals", + "org.junit.jupiter.api.Assertions.assertNotEquals", + "org.junit.jupiter.api.Assertions.assertNull", + "org.junit.jupiter.api.Assertions.assertNotNull", + "org.junit.jupiter.api.Assertions.assertArrayEquals", + "org.junit.jupiter.api.Assertions.assertIterableEquals", + "org.junit.jupiter.api.Assertions.assertInstanceOf", // assertThat (allowed is only org.assertj.core.api.Assertions.assertThat) "org.assertj.core.api.AssertionsForClassTypes.assertThat", "org.assertj.core.api.AssertionsForClassTypes.assertThatCode", @@ -508,11 +519,11 @@ public void check(JavaClass testClass, ConditionEvents events) { /* ****************************************************************** */ - private static String getTestClassSuffixRegex() { + protected static String getTestClassSuffixRegex() { return "(" + String.join("|", TEST_CLASS_SUFFIXES) + ")$"; } - private static String getTestClassRegex() { + protected static String getTestClassRegex() { return ".+%s".formatted(getTestClassSuffixRegex()); } } From 4f9a6fe70f9fa0f90f546ea7fe3a7b7edbb78f83 Mon Sep 17 00:00:00 2001 From: Andreas Hufler Date: Fri, 16 Jan 2026 15:48:58 +0100 Subject: [PATCH 2/2] fix ordering --- .../toolbox/ArchitectureTestBase.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java b/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java index 84286cd..b8eb625 100644 --- a/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java +++ b/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java @@ -30,15 +30,6 @@ public abstract class ArchitectureTestBase { "org.assertj.core.api.Assertions.assertThatThrownBy", "org.junit.jupiter.api.Assertions.assertThrows", "org.junit.jupiter.api.Assertions.assertDoesNotThrow", - "org.junit.jupiter.api.Assertions.assertTrue", - "org.junit.jupiter.api.Assertions.assertFalse", - "org.junit.jupiter.api.Assertions.assertEquals", - "org.junit.jupiter.api.Assertions.assertNotEquals", - "org.junit.jupiter.api.Assertions.assertNull", - "org.junit.jupiter.api.Assertions.assertNotNull", - "org.junit.jupiter.api.Assertions.assertArrayEquals", - "org.junit.jupiter.api.Assertions.assertIterableEquals", - "org.junit.jupiter.api.Assertions.assertInstanceOf", // assertThat (allowed is only org.assertj.core.api.Assertions.assertThat) "org.assertj.core.api.AssertionsForClassTypes.assertThat", "org.assertj.core.api.AssertionsForClassTypes.assertThatCode", @@ -60,6 +51,16 @@ public abstract class ArchitectureTestBase { "org.junit.Assert.assertThrows", "org.junit.Assert.assertTrue", "org.junit.Assert.fail", + // use assertThat (org.assertj.core.api.Assertions.assertThat) + "org.junit.jupiter.api.Assertions.assertArrayEquals", + "org.junit.jupiter.api.Assertions.assertEquals", + "org.junit.jupiter.api.Assertions.assertFalse", + "org.junit.jupiter.api.Assertions.assertInstanceOf", + "org.junit.jupiter.api.Assertions.assertIterableEquals", + "org.junit.jupiter.api.Assertions.assertNotEquals", + "org.junit.jupiter.api.Assertions.assertNotNull", + "org.junit.jupiter.api.Assertions.assertNull", + "org.junit.jupiter.api.Assertions.assertTrue", "org.testcontainers.shaded.org.hamcrest.MatcherAssert.assertThat" ) );