Skip to content

WW-5630 Streamline ConfigParseUtilTest and convert to JUnit 4 (6.x)#1741

Merged
lukaszlenart merged 1 commit into
support/struts-6-x-xfrom
WW-5630-configparseutil-test-cleanup-6x
Jun 14, 2026
Merged

WW-5630 Streamline ConfigParseUtilTest and convert to JUnit 4 (6.x)#1741
lukaszlenart merged 1 commit into
support/struts-6-x-xfrom
WW-5630-configparseutil-test-cleanup-6x

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Port of #1740 to support/struts-6-x-x.

Test-only cleanup of ConfigParseUtilTest (added on 6.x via #1736, cherry-pick of #1721):

  • Collapse redundancy: 12 overlapping cache tests → 5 focused ones (single-loader caching, per-loader isolation incl. the same-toString() case, outer-size bound, inner-size bound, and the negative/not-cached case).
  • Drop the ~80-entry literal: the inner-cache size-bound test now generates synthetic class names in a loop bounded by the per-loader limit (read via the existing helper) instead of hardcoding a giant JDK class-name array.
  • Remove unnecessary reflection: the behavioral tests assert via load counts only; reflection is retained solely in the two size-bound tests, where Caffeine exposes no public seam for estimatedSize().
  • JUnit 3 → JUnit 4: @Test/@Before/@After with static org.junit.Assert.*, matching the convention of newer core unit tests (e.g. NamedVariablePatternMatcherTest).
  • Also reorders the caffeine imports in ConfigParseUtil.java to alphabetical (matching WW-5630 - Performance Issue SecurityMemberAccess #1721 on main).

Production caching logic is unchanged.

Test Plan

  • ./mvnw -pl core clean test -Dtest=ConfigParseUtilTest → Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
  • ./mvnw -pl core apache-rat:check → BUILD SUCCESS

🤖 Generated with Claude Code

…it 4

Port of #1740 to 6.x: 12 overlapping cache tests collapsed to 5 focused
ones, JUnit 3 -> JUnit 4, dropped the ~80-class literal, reflection kept
only in the two size-bound tests. Also reorders the caffeine imports in
ConfigParseUtil to match alphabetical ordering. Production logic unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart lukaszlenart merged commit e2fa549 into support/struts-6-x-x Jun 14, 2026
10 checks passed
@lukaszlenart lukaszlenart deleted the WW-5630-configparseutil-test-cleanup-6x branch June 14, 2026 16:36
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.

1 participant