Skip to content

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

Description

@natechadwick-intsof

Summary

Three unit tests in projects/sitemanage fail when the module's full surefire run executes. They pass in isolation but fail when the test JVM has prior state from earlier test classes.

Failing tests

  1. PSItemServiceTest.setUp:102 — IllegalArgumentException: Cannot set rxDir system property rxdeploydir value /home/nate/.../tmp/junit<id> does not exist
  2. PSDispatchingPathServicePathParsingTest.shouldFailOnNormalizeNullPath — expected<IllegalArgumentException> but was<NullPointerException>
  3. PSDispatchingPathServicePathParsingTest.shouldFailToReturnProperFullPathIfGivenRelativePathIsNull — expected<IllegalArgumentException> but was<NullPointerException>

Root cause

Fix

  • 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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions