From a613a51776adc63c2d885f8a486889ec0781f31b Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sat, 25 Feb 2023 17:40:01 -0500 Subject: [PATCH 1/2] [tests] Add check that we are not missing classes for analysis Test ensures issue with aux path fix in 4.7.3.1 does not resurface. Confirmed this test will fail with usage of 4.7.3.1 but is fixed now on latest. --- .../invoker.properties | 4 ++ src/it/check-no-missing-classes/pom.xml | 70 +++++++++++++++++++ .../src/main/java/test/App.java | 14 ++++ src/it/check-no-missing-classes/verify.groovy | 21 ++++++ 4 files changed, 109 insertions(+) create mode 100644 src/it/check-no-missing-classes/invoker.properties create mode 100644 src/it/check-no-missing-classes/pom.xml create mode 100644 src/it/check-no-missing-classes/src/main/java/test/App.java create mode 100644 src/it/check-no-missing-classes/verify.groovy diff --git a/src/it/check-no-missing-classes/invoker.properties b/src/it/check-no-missing-classes/invoker.properties new file mode 100644 index 000000000..d5da9063b --- /dev/null +++ b/src/it/check-no-missing-classes/invoker.properties @@ -0,0 +1,4 @@ +invoker.goals = clean compile spotbugs:check + +# The expected result of the build, possible values are "success" (default) and "failure" +invoker.buildResult = success diff --git a/src/it/check-no-missing-classes/pom.xml b/src/it/check-no-missing-classes/pom.xml new file mode 100644 index 000000000..02e01db6c --- /dev/null +++ b/src/it/check-no-missing-classes/pom.xml @@ -0,0 +1,70 @@ + + + + 4.0.0 + + spotbugs-maven-plugin.it + check-no-missing-classes + testing + check-no-missing-classes + jar + + + org.junit.jupiter + junit-jupiter-engine + @junitVersion@ + + + + + + com.github.spotbugs + spotbugs-maven-plugin + @pom.version@ + + true + false + @spotbugsTestDebug@ + High + + + + run-analysis + process-classes + + spotbugs + + + + process-results + + verify + + + + + + + diff --git a/src/it/check-no-missing-classes/src/main/java/test/App.java b/src/it/check-no-missing-classes/src/main/java/test/App.java new file mode 100644 index 000000000..e4c6765b8 --- /dev/null +++ b/src/it/check-no-missing-classes/src/main/java/test/App.java @@ -0,0 +1,14 @@ +package test; + +import org.junit.jupiter.api.Assertions; + +/** + * Hello world! + */ +public class App { + + public static void main( String[] args ) { + Assertions.assertNull(args); + System.out.println( "Hello World!" ); + } +} diff --git a/src/it/check-no-missing-classes/verify.groovy b/src/it/check-no-missing-classes/verify.groovy new file mode 100644 index 000000000..14f621bf1 --- /dev/null +++ b/src/it/check-no-missing-classes/verify.groovy @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2006-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Check no missing classes + +File buildLog = new File( basedir, 'build.log' ) +assert !buildLog.text.contains( 'The following classes needed for analysis were missing' ) + From 7f0dd1e3c0f059361fe4eb03736a40d57db73ec7 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sat, 25 Feb 2023 17:58:28 -0500 Subject: [PATCH 2/2] [test] Set new test to use jdk 8 --- src/it/check-no-missing-classes/pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/it/check-no-missing-classes/pom.xml b/src/it/check-no-missing-classes/pom.xml index 02e01db6c..0776017c2 100644 --- a/src/it/check-no-missing-classes/pom.xml +++ b/src/it/check-no-missing-classes/pom.xml @@ -30,6 +30,10 @@ testing check-no-missing-classes jar + + 1.8 + 1.8 + org.junit.jupiter