Skip to content

Commit

Permalink
Fixing test name convention #3713
Browse files Browse the repository at this point in the history
  • Loading branch information
lorriborri committed Jan 8, 2025
1 parent b1f2640 commit 94f2977
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ private static Path resolveRoothPath() {
return !location.contains("/test/"); // ignore any URI to sources that contains '/test/'
};

static ImportOption ignoreAllMain= location -> {
return !location.contains("/main/"); // ignore any URI to sources that contains '/main/'
};

static List<ImportOption> ignoreFolders = new ArchUnitRuntimeSupport().createImportOptionsIgnoreFolder(); // ignore specific folders e.g. build folders

static ImportOption ignoreSechubOpenAPIJava = location -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void classes_in_test_packages_containing_test_or_assert_in_name() {
/* @formatter:off */
JavaClasses importedClasses = new ClassFileImporter()
.withImportOptions(ignoreFolders)
.withImportOption(ignoreAllMain)
.withImportOption(ignoreSechubOpenAPIJava)
.withImportOption(ignoreSechubTestframework)
.withImportOption(ignoreSharedkernelTest)
Expand All @@ -30,9 +31,8 @@ void classes_in_test_packages_containing_test_or_assert_in_name() {
.importPath(SECHUB_ROOT_PATH);

/* execute + test */
// workaround for resideInAnyPackage not working, using ignoreFolders (ignore main) instead
ArchRule rule = ArchRuleDefinition.classes()
.that()
.resideInAPackage("..test..")
.should()
.haveSimpleNameContaining("Test")
.orShould()
Expand Down

0 comments on commit 94f2977

Please sign in to comment.