java.lang.Object
com.agentforge4j.testkit.assertion.ForbiddenTermScanner
Generic, reusable scanner asserting that a configurable set of forbidden terms is absent from a
tree of shipped OSS resource files (workflow definitions, agent bundles, prompts, verification
fixtures, examples). It complements the run-output check
WorkflowRunAssert.outputsHaveNoForbiddenTerms(Collection): that one scans a run's context
and captured files, this one scans resource files on disk that never flow through a run.
Matching is case-insensitive and substring-based. Files are read as UTF-8 text; a file that is
not valid UTF-8 is skipped as non-text. Callers pass a fileFilter to scope the scan to the
text resource kinds they care about (for example .json / .md).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne forbidden-term hit. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertNoForbiddenTerms(Path root, Collection<String> forbiddenTerms, Predicate<Path> fileFilter) Scansrootand throws anAssertionErrorlisting every violation when any forbidden term is found.static List<ForbiddenTermScanner.Violation>Scans every regular file underrootthat matchesfileFilterfor any forbidden term.
-
Method Details
-
scan
public static List<ForbiddenTermScanner.Violation> scan(Path root, Collection<String> forbiddenTerms, Predicate<Path> fileFilter) Scans every regular file underrootthat matchesfileFilterfor any forbidden term.- Parameters:
root- the resource-tree root to scan; must not benullforbiddenTerms- the terms that must be absent; must not be emptyfileFilter- selects which files to scan; must not benull- Returns:
- all violations found, in file then line order (empty when clean)
-
assertNoForbiddenTerms
public static void assertNoForbiddenTerms(Path root, Collection<String> forbiddenTerms, Predicate<Path> fileFilter) Scansrootand throws anAssertionErrorlisting every violation when any forbidden term is found.- Parameters:
root- the resource-tree root to scan; must not benullforbiddenTerms- the terms that must be absent; must not be emptyfileFilter- selects which files to scan; must not benull
-