From 8f89caa5f103425081d38c9361afca621d282cc6 Mon Sep 17 00:00:00 2001 From: Dirk Mahler Date: Sun, 14 Jul 2024 15:41:50 +0200 Subject: [PATCH] #408 added baseline test to AnalyzeIT --- .../commandline/test/AbstractCLIIT.java | 5 +++-- .../jqassistant/commandline/test/AnalyzeIT.java | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AbstractCLIIT.java b/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AbstractCLIIT.java index ee4941ea42..bbf6aa4dcb 100644 --- a/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AbstractCLIIT.java +++ b/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AbstractCLIIT.java @@ -152,8 +152,9 @@ public static void beforeAll() { @BeforeEach public void before(DISTRIBUTION distribution) throws IOException { assumeThat(Runtime.version() - .feature()).isGreaterThanOrEqualTo(distribution.minRuntimeVersion.feature()) - .isLessThanOrEqualTo(distribution.maxRuntimeVersion.feature()); + .feature()).describedAs("Java runtime version") + .isGreaterThanOrEqualTo(distribution.minRuntimeVersion.feature()) + .isLessThanOrEqualTo(distribution.maxRuntimeVersion.feature()); this.neo4jVersion = distribution.name() .toLowerCase(Locale.getDefault()); this.jqaHome = getjQAHomeDirectory(neo4jVersion); diff --git a/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AnalyzeIT.java b/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AnalyzeIT.java index 14cb215207..d58418e08d 100644 --- a/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AnalyzeIT.java +++ b/cli/test/src/test/java/com/buschmais/jqassistant/commandline/test/AnalyzeIT.java @@ -39,6 +39,21 @@ void constraint() { withStore(store -> verifyConcepts(store, TEST_CONCEPT)); } + @DistributionTest + void constraintWithBaseline() { + File baselineFile = new File(RULES_DIRECTORY + "/jqassistant-baseline.xml"); + if (baselineFile.exists()) { + assertThat(baselineFile.delete()).isTrue(); + } + String[] args = new String[] { "analyze", "-D", "jqassistant.analyze.rule.directory=" + RULES_DIRECTORY, "-D", + "jqassistant.analyze.constraints=" + TEST_CONSTRAINT, "-D", "jqassistant.analyze.baseline.enabled=true" }; + // create baseline + assertThat(execute(args).getExitCode()).isEqualTo(2); + assertThat(baselineFile).exists(); + // create run with baseline + assertThat(execute(args).getExitCode()).isZero(); + } + @DistributionTest void excludeConstraint() { String[] args = new String[] { "analyze", "-D", "jqassistant.analyze.rule.directory=" + RULES_DIRECTORY, "-D",