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..b8eb625 100644 --- a/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java +++ b/src/main/java/it/aboutbits/archunit/toolbox/ArchitectureTestBase.java @@ -28,6 +28,8 @@ 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", // assertThat (allowed is only org.assertj.core.api.Assertions.assertThat) "org.assertj.core.api.AssertionsForClassTypes.assertThat", "org.assertj.core.api.AssertionsForClassTypes.assertThatCode", @@ -49,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" ) ); @@ -508,11 +520,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()); } }