Skip to content

Fix path separator assertions in tests for Windows compatibility - #121

Merged
bernardladenthin merged 1 commit into
mainfrom
claude/zen-franklin-7skm2g
Jun 26, 2026
Merged

Fix path separator assertions in tests for Windows compatibility#121
bernardladenthin merged 1 commit into
mainfrom
claude/zen-franklin-7skm2g

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Summary

  • Fixed two test assertions that hardcoded forward slashes (/) in expected path strings, causing failures on Windows where Paths.get("/") renders with backslashes
  • Updated MockAiGenerationProviderTest.generateFallsBackToFullPathWhenFileNameNull() and AiPromptSupportTest.buildPromptUsesFullPathWhenFileNameNull() to derive expected path strings from the actual Path object being tested
  • Added clarifying comments explaining why the platform-specific separator is necessary

Test plan

  • Affected unit tests now pass on both POSIX and Windows platforms
  • CI will verify the fix across all supported environments

Related issues / PRs

Fixes cross-platform test failures on Windows.

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • My commits follow Conventional Commits
  • No security-sensitive changes

https://claude.ai/code/session_01FHNW6HtnBwNm3DFRGuHxfZ

Two tests construct a root path via Paths.get("/") and assert the
"file name is null -> fall back to the full path string" branch using a
hardcoded POSIX separator. On Windows Paths.get("/").toString() returns
"\", so the assertions failed there while passing on Linux/macOS. The
production code is correct (it intentionally falls back to the full
Path.toString() when getFileName() is null); only the expected values
were hardcoded to "/".

Derive the expected string from the same Path object instead of
hardcoding the separator. Paths.get("/") still yields a null file name
on every OS, so the intended fallback branch stays exercised:
- AiPromptSupportTest.buildPromptUsesFullPathWhenFileNameNull
- MockAiGenerationProviderTest.generateFallsBackToFullPathWhenFileNameNull

mvn test: Tests run: 174, Failures: 0, Errors: 0, Skipped: 1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHNW6HtnBwNm3DFRGuHxfZ
@bernardladenthin
bernardladenthin merged commit 1e86dc7 into main Jun 26, 2026
8 of 10 checks passed
@bernardladenthin
bernardladenthin deleted the claude/zen-franklin-7skm2g branch June 26, 2026 15:15
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants