Skip to content

fix: migrate all integration tests to JUnit 5 and fix revealed failures#826

Merged
ismisepaul merged 7 commits intodevfrom
dev#825
Mar 31, 2026
Merged

fix: migrate all integration tests to JUnit 5 and fix revealed failures#826
ismisepaul merged 7 commits intodevfrom
dev#825

Conversation

@ismisepaul
Copy link
Copy Markdown
Member

@ismisepaul ismisepaul commented Mar 31, 2026

Summary

  • Migrates all 37 IT files from JUnit 4 (org.junit.Test, @Before, @BeforeClass) to JUnit 5 (org.junit.jupiter.api.*)
  • These tests were silently skipped because the project has junit-jupiter-engine but no junit-vintage-engine
  • Converted @Test(expected=...) patterns to assertThrows()
  • No junit-vintage-engine dependency needed

Production bugs fixed (revealed by newly-running tests)

  • CountdownHandler.saveCountdowns: copy-paste bug where startTime was saved as lockTime, corrupting DB countdown state
  • CountdownHandler: added forceReload() method — the static cache had no invalidation mechanism, causing stale state across test classes when CountdownHandlerIT left hasEnded=true
  • EnableModuleBlock: error message casing "received""Received" to match expected output

Test fixes

  • XxeChallenge1IT: was using XxeLesson servlet instead of XxeChallenge1OldWebService — the lesson's "Wrong File" check blocks challenge file content
  • TestProperties.executeSql: calls CountdownHandler.forceReload() after DB reset; migrated stale JUnit 4 import

Closes #825

Test plan

ismisepaul and others added 5 commits March 31, 2026 22:34
37 IT files were using JUnit 4 annotations (org.junit.Test, @before,
@BeforeClass, etc.) but the project only has junit-jupiter-engine —
no junit-vintage-engine. The JUnit Platform silently skipped them all,
reporting 0 tests run with no warning.

Migrated all IT files to JUnit 5: updated imports, annotations,
and converted @test(expected=...) to assertThrows().

Closes #825
- CountdownHandler.saveCountdowns: fix copy-paste bug where startTime
  was saved as lockTime, corrupting DB state
- CountdownHandler: add forceReload() so cached static state can be
  invalidated when tests reset the database
- TestProperties.executeSql: call forceReload() after DB reset to
  prevent stale CountdownHandler state across test classes
- EnableModuleBlock: fix error message casing ("received" → "Received")
- XxeChallenge1IT: use XxeChallenge1OldWebService (the XML-based
  challenge endpoint) instead of XxeLesson (which blocks challenge
  file content with its "Wrong File" check)
@ismisepaul ismisepaul changed the title fix: migrate all integration tests from JUnit 4 to JUnit 5 fix: migrate all integration tests to JUnit 5 and fix revealed failures Mar 31, 2026
ismisepaul and others added 2 commits March 31, 2026 23:30
XxeChallenge1OldWebService was processing requests even when the module
was closed, unlike its sibling XxeChallenge1 which properly checks
Getter.isModuleOpen(). This caused XxeChallenge1IT
testLevelWhenUnsafeLevelsAreDisabled to fail.
@ismisepaul ismisepaul merged commit cb3922b into dev Mar 31, 2026
12 checks passed
ismisepaul added a commit that referenced this pull request Mar 31, 2026
…es (#826)

* fix: migrate all integration tests from JUnit 4 to JUnit 5 (#825)

37 IT files were using JUnit 4 annotations (org.junit.Test, @before,
@BeforeClass, etc.) but the project only has junit-jupiter-engine —
no junit-vintage-engine. The JUnit Platform silently skipped them all,
reporting 0 tests run with no warning.

Migrated all IT files to JUnit 5: updated imports, annotations,
and converted @test(expected=...) to assertThrows().

Closes #825

* style: apply google-java-format to SetterIT.java

* fix: resolve 8 integration test failures revealed by JUnit 5 migration

- CountdownHandler.saveCountdowns: fix copy-paste bug where startTime
  was saved as lockTime, corrupting DB state
- CountdownHandler: add forceReload() so cached static state can be
  invalidated when tests reset the database
- TestProperties.executeSql: call forceReload() after DB reset to
  prevent stale CountdownHandler state across test classes
- EnableModuleBlock: fix error message casing ("received" → "Received")
- XxeChallenge1IT: use XxeChallenge1OldWebService (the XML-based
  challenge endpoint) instead of XxeLesson (which blocks challenge
  file content with its "Wrong File" check)

* fix: add missing module-open check to XxeChallenge1OldWebService

XxeChallenge1OldWebService was processing requests even when the module
was closed, unlike its sibling XxeChallenge1 which properly checks
Getter.isModuleOpen(). This caused XxeChallenge1IT
testLevelWhenUnsafeLevelsAreDisabled to fail.
@ismisepaul ismisepaul moved this to Done in Security Shepherd Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

140 integration tests silently skipped (JUnit 4 without vintage engine)

1 participant