From 3c379ba15448db5ea7f62d79b6b3f6a7d93a9bd7 Mon Sep 17 00:00:00 2001 From: Robert Sandell Date: Wed, 14 Dec 2022 12:55:33 +0100 Subject: [PATCH] Bump plugin utils API (#203) --- pom.xml | 3 +++ .../io/jenkins/plugins/checks/ArchitectureTest.java | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ebf8ef5e..accf5511 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ jenkinsci/${project.artifactId}-plugin 1.17.6 + 2.20.0 @@ -44,10 +45,12 @@ io.jenkins.plugins plugin-util-api + ${plugin-util-api.version} io.jenkins.plugins plugin-util-api + ${plugin-util-api.version} tests test diff --git a/src/test/java/io/jenkins/plugins/checks/ArchitectureTest.java b/src/test/java/io/jenkins/plugins/checks/ArchitectureTest.java index ebf28a94..9122e1bd 100644 --- a/src/test/java/io/jenkins/plugins/checks/ArchitectureTest.java +++ b/src/test/java/io/jenkins/plugins/checks/ArchitectureTest.java @@ -1,9 +1,10 @@ package io.jenkins.plugins.checks; +import com.tngtech.archunit.core.domain.JavaModifier; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.lang.ArchRule; -import com.tngtech.archunit.lang.syntax.elements.ClassesShouldConjunction; +import com.tngtech.archunit.lang.syntax.ArchRuleDefinition; import edu.hm.hafner.util.ArchitectureRules; import io.jenkins.plugins.util.PluginArchitectureRules; import org.junit.runner.RunWith; @@ -20,8 +21,12 @@ class ArchitectureTest { static final ArchRule NO_JENKINS_INSTANCE_CALL = PluginArchitectureRules.NO_JENKINS_INSTANCE_CALL; @ArchTest - static final ArchRule NO_PUBLIC_TEST_CLASSES = ((ClassesShouldConjunction) ArchitectureRules.NO_PUBLIC_TEST_CLASSES) - .andShould().notBeAnnotatedWith(RunWith.class); // Allow for JUnit4 tests. + static final ArchRule NO_PUBLIC_TEST_CLASSES = ArchRuleDefinition.noClasses() + .that().haveSimpleNameEndingWith("Test") + .and().haveSimpleNameNotContaining("_jmh") + .and().doNotHaveModifier(JavaModifier.ABSTRACT).should().bePublic() + .andShould().notBeAnnotatedWith(RunWith.class) + .because("test classes are not part of the API and should be hidden in a package"); @ArchTest static final ArchRule NO_TEST_API_CALLED = ArchitectureRules.NO_TEST_API_CALLED;