Skip to content

Commit

Permalink
#408 added baseline test to AnalyzeIT
Browse files Browse the repository at this point in the history
  • Loading branch information
DirkMahler committed Jul 14, 2024
1 parent b166785 commit 8f89caa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8f89caa

Please sign in to comment.