Skip to content

fix(sitemanage): resolve 3 failing unit tests (#199) - #200

Merged
natechadwick merged 1 commit into
mainfrom
bugfix/199-sitemanage-failing-tests
Sep 8, 2026
Merged

fix(sitemanage): resolve 3 failing unit tests (#199)#200
natechadwick merged 1 commit into
mainfrom
bugfix/199-sitemanage-failing-tests

Conversation

@natechadwick-intsof

Copy link
Copy Markdown
Collaborator

Summary

Fixes #199. Resolves three failing unit tests in projects/sitemanage:

  • PSItemServiceTest.setUp:102IllegalArgumentException: Cannot set rxDir system property rxdeploydir value ... does not exist
  • PSDispatchingPathServicePathParsingTest.shouldFailOnNormalizeNullPathexpected<IllegalArgumentException> but was<NullPointerException>
  • PSDispatchingPathServicePathParsingTest.shouldFailToReturnProperFullPathIfGivenRelativePathIsNullexpected<IllegalArgumentException> but was<NullPointerException>

Root cause

  • PSDispatchingPathService$PathNormalizer.normalizePath and PSDispatchingPathService$PathMatch.toFullPath were guarding null inputs with org.apache.commons.lang3.Validate.notNull(...), which throws NullPointerException. The IPSPathNormalizer.normalizePath interface explicitly declares throws IllegalArgumentException, and the tests expect that exception.
  • PSItemService's constructor calls PathUtils.getRxDir(null), which reads the rxdeploydir system property. Earlier test classes in the surefire JVM set rxdeploydir to a JUnit TemporaryFolder root; once that test class finishes, the temp folder is deleted but the property remains, so the next class to load PathUtils.getRxDir blows up. PSItemServiceTest itself never established a valid rxdeploydir.

Changes

  • PSDispatchingPathService: replace notNull(...) guards in PathNormalizer.normalizePath and PathMatch.toFullPath with explicit if (... == null) throw new IllegalArgumentException(...) checks so the contract matches the IPSPathNormalizer interface and the test expectations.
  • PSItemServiceTest: add a @Rule TemporaryFolder and, in setUp / tearDown, use PathUtils.setThreadOnlyRxDir / unsetThreadOnlyRxDir plus PathUtils.clearRxDir() (the same pattern already used by PSEnsureMyFacesSecretTest in the same module) to isolate the test from rxdeploydir state left by other test classes.

Verification

[INFO] Tests run: 314, Failures: 0, Errors: 0, Skipped: 17
[INFO] BUILD SUCCESS

The 17 skipped tests are the pre-existing @Ignored tests, unchanged from the baseline. ./mvn-env.sh spotless:check -pl projects/sitemanage is clean.

Co-Authored by mavis mavis using MiniMax-M3 with agent mavis.

PSDispatchingPathService$PathNormalizer.normalizePath and
PSDispatchingPathService$PathMatch.toFullPath were guarding null inputs
with org.apache.commons.lang3.Validate.notNull, which throws
NullPointerException. The IPSPathNormalizer.normalizePath contract
declares throws IllegalArgumentException, and the unit tests in
PSDispatchingPathServicePathParsingTest expect that exception. Replace
the Validate.notNull guards with explicit null checks that throw
IllegalArgumentException, matching the interface and the tests
(shouldFailOnNormalizeNullPath, shouldFailToReturnProperFullPathIfGivenRelativePathIsNull).

PSItemServiceTest.setUp was failing with
"Cannot set rxDir system property rxdeploydir value ... does not exist"
when running the full sitemanage surefire suite. Earlier test classes in
the same forked JVM set rxdeploydir to a JUnit TemporaryFolder root; once
that class finishes the temp folder is deleted but the system property
remains, so the next class to load PathUtils.getRxDir blows up when it
tries to construct PSItemService (which calls
PathUtils.getRxDir(null) for PSEncryptor). Point PathUtils at a fresh
TemporaryFolder via setThreadOnlyRxDir / clearRxDir in setUp and clean it
up in tearDown, the same isolation pattern already used by
PSEnsureMyFacesSecretTest in the same module.

Verified locally: 314 tests run, 0 failures, 0 errors, 17 skipped
(skipped are pre-existing @ignore'd tests, unchanged).

Closes #199

> Co-Authored by mavis mavis using MiniMax-M3 with agent mavis.
@natechadwick
natechadwick merged commit 1679583 into main Sep 8, 2026
3 checks passed
@natechadwick
natechadwick deleted the bugfix/199-sitemanage-failing-tests branch September 8, 2026 14:09
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.

sitemanage: fix 3 failing unit tests (PSItemServiceTest, PSDispatchingPathServicePathParsingTest)

2 participants