Fix: Duplicate test files loaded when same classpath resource appears in multiple roots
Summary
getAllEndPointFiles() collects the same JSON file twice when it exists in more than one classpath root (e.g. both a file: directory and a jar:), causing false-positive duplicate scenario name errors.
Problem
When a test package is present in multiple classpath entries — a common setup when a JAR is added alongside the test-classes directory — contextClassLoader.getResources(packagePath) returns one URL per
classpath root. Each URL is scanned independently, so the same relative file path (e.g. scenarios/login.json) ends up in the list twice.
This causes checkDuplicateScenarios() to throw a unwanted error even though there is only one physical scenario file with that name.
Acceptance Criteria
getAllEndPointFiles() returns no duplicate file paths regardless of how many classpath roots contain the same package.
checkDuplicateScenarios() does not throw for files deduplicated at the path level.
checkDuplicateScenarios() still throws when two different files genuinely share the same scenarioName.
- Returned list is sorted for deterministic ordering.
##Proposed Solution
Apply .distinct().sorted() on the collected file list before returning it from getAllEndPointFiles(). No change to scenario name validation logic required.
Fix: Duplicate test files loaded when same classpath resource appears in multiple roots
Summary
getAllEndPointFiles()collects the same JSON file twice when it exists in more than one classpath root (e.g. both afile:directory and ajar:), causing false-positive duplicate scenario name errors.Problem
When a test package is present in multiple classpath entries — a common setup when a JAR is added alongside the test-classes directory —
contextClassLoader.getResources(packagePath)returns one URL perclasspath root. Each URL is scanned independently, so the same relative file path (e.g.
scenarios/login.json) ends up in the list twice.This causes
checkDuplicateScenarios()to throw a unwanted error even though there is only one physical scenario file with that name.Acceptance Criteria
getAllEndPointFiles()returns no duplicate file paths regardless of how many classpath roots contain the same package.checkDuplicateScenarios()does not throw for files deduplicated at the path level.checkDuplicateScenarios()still throws when two different files genuinely share the samescenarioName.##Proposed Solution
Apply
.distinct().sorted()on the collected file list before returning it fromgetAllEndPointFiles(). No change to scenario name validation logic required.