From cfab68ba8ad110d78d370407cf9000c713b5e582 Mon Sep 17 00:00:00 2001 From: Stijn Dejongh Date: Wed, 25 Sep 2024 05:16:41 +0200 Subject: [PATCH] Fixup some code quality metric issues --- .../testing/conventions/CodeConventions.java | 2 +- .../testing/ConventionsAdherenceTests.java | 36 +++++++++++++++++++ .../commons/ConventionsAdherenceTests.java | 11 ++++-- .../access/AccessProtectionUtilsTest.java | 1 - pom.xml | 1 + 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100755 commons-testing/src/test/java/be/sddevelopment/commons/testing/ConventionsAdherenceTests.java diff --git a/commons-testing/src/main/java/be/sddevelopment/commons/testing/conventions/CodeConventions.java b/commons-testing/src/main/java/be/sddevelopment/commons/testing/conventions/CodeConventions.java index cddeb54..f2992a2 100755 --- a/commons-testing/src/main/java/be/sddevelopment/commons/testing/conventions/CodeConventions.java +++ b/commons-testing/src/main/java/be/sddevelopment/commons/testing/conventions/CodeConventions.java @@ -88,7 +88,7 @@ private static GivenClassesConjunction constantClasses() { return classes().that().areAnnotatedWith(Constants.class).and().areNotAnnotations(); } - static ArchCondition notBeInstantiatable() { + static ArchCondition notBeInstantiatable() { return new ArchCondition<>("not be instantiatable") { @Override public void check(JavaClass item, ConditionEvents events) { diff --git a/commons-testing/src/test/java/be/sddevelopment/commons/testing/ConventionsAdherenceTests.java b/commons-testing/src/test/java/be/sddevelopment/commons/testing/ConventionsAdherenceTests.java new file mode 100755 index 0000000..2b5a714 --- /dev/null +++ b/commons-testing/src/test/java/be/sddevelopment/commons/testing/ConventionsAdherenceTests.java @@ -0,0 +1,36 @@ +/*- + * #%L + * commons + * %% + * Copyright (C) 2020 - 2024 SD Development + * %% + * Licensed under the EUPL, Version 1.1 or – as soon they will be + * approved by the European Commission - subsequent versions of the + * EUPL (the "Licence"); + * + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl5 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * #L% + */ + +package be.sddevelopment.commons.testing; + +import be.sddevelopment.commons.testing.conventions.CodeConventions; +import com.tngtech.archunit.junit.AnalyzeClasses; + +@AnalyzeClasses(packages = "be.sddevelopment.commons.testing") +public class ConventionsAdherenceTests implements CodeConventions { + + /* This class can be empty, it is used to run the test of its parent interface + * CodeConventions. This interface contains the tests for the code conventions, + * and will execute them based on the {@code @AnalyzeClasses} annotation. + */ +} diff --git a/commons/src/test/java/be/sddevelopment/commons/ConventionsAdherenceTests.java b/commons/src/test/java/be/sddevelopment/commons/ConventionsAdherenceTests.java index e88a725..e647f9d 100755 --- a/commons/src/test/java/be/sddevelopment/commons/ConventionsAdherenceTests.java +++ b/commons/src/test/java/be/sddevelopment/commons/ConventionsAdherenceTests.java @@ -7,12 +7,12 @@ * Licensed under the EUPL, Version 1.1 or – as soon they will be * approved by the European Commission - subsequent versions of the * EUPL (the "Licence"); - * + * * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: - * + * * http://ec.europa.eu/idabc/eupl5 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,4 +29,9 @@ @AnalyzeClasses(packages = "be.sddevelopment.commons") public class ConventionsAdherenceTests implements CodeConventions { + /* This class can be empty, it is used to run the test of its parent interface + * CodeConventions. This interface contains the tests for the code conventions, + * and will execute them based on the {@code @AnalyzeClasses} annotation. + */ + } diff --git a/commons/src/test/java/be/sddevelopment/commons/access/AccessProtectionUtilsTest.java b/commons/src/test/java/be/sddevelopment/commons/access/AccessProtectionUtilsTest.java index d1b80d9..f2c6354 100755 --- a/commons/src/test/java/be/sddevelopment/commons/access/AccessProtectionUtilsTest.java +++ b/commons/src/test/java/be/sddevelopment/commons/access/AccessProtectionUtilsTest.java @@ -24,7 +24,6 @@ package be.sddevelopment.commons.access; import static be.sddevelopment.commons.testing.ReflectionAssertionUtils.assertPrivateMemberReflectionProtection; -import static org.assertj.core.api.Assertions.assertThatThrownBy; import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing; import java.lang.reflect.Constructor; diff --git a/pom.xml b/pom.xml index 4d835be..15ee830 100755 --- a/pom.xml +++ b/pom.xml @@ -257,6 +257,7 @@ be/sddevelopment/commons/constants/**/*.class + be/sddevelopment/commons/testing/conventions/**/*.class