Skip to content

Gate platform-optional test assertions on probed capabilities - #63

Merged
garydgregory merged 1 commit into
apache:mainfrom
ppkarwasz:fix/android-test-capabilities
Aug 30, 2026
Merged

Gate platform-optional test assertions on probed capabilities#63
garydgregory merged 1 commit into
apache:mainfrom
ppkarwasz:fix/android-test-capabilities

Conversation

@ppkarwasz

Copy link
Copy Markdown
Member

Makes the Android instrumented suite green after #62 by gating platform-optional test assertions on probed capabilities instead of platform checks.

  • AttackTestSupport gains seven probe-once constants built on a supportsConfiguration(Executable) helper: DOM_SUPPORTS_SCHEMA/SECURE_PROCESSING/XINCLUDE and SAX_SUPPORTS_RESET/SCHEMA/SECURE_PROCESSING/XINCLUDE. Each probes the platform default factory once at class load; Android's implementations inherit the throwing JAXP base methods, so the guarded assertions skip there and start running automatically on any platform that adds the capability.
  • The DOM wrapper-contract tests skip via the existing DOM_RESOLVES_INTERNAL_ENTITIES probe where the platform DOM is deliberately left unwrapped.
  • The newDefault* smoke tests drop their obsolete assertThrows(FactoryConfigurationError) Android branches (the merged degradation makes the methods succeed) and guard only the FSP assertions; the TrAX variant asserts its documented Android contract, TransformerFactoryConfigurationError, since TrAX is outside the degradation's scope.
  • Every SecureFactoriesSmokeTest method now carries the tag of the JAXP factory it exercises, so the smoke tests run across the whole implementation matrix. That exposed the schema smoke tests asserting the stock JDK's FEATURE_SECURE_PROCESSING default rather than the library's contract (schema securing is the resolver floor plus secure sub-parsers; FSP is deliberately not set on the factory): they now assert the wrapped SecureSchema product instead.

Verified: full JVM surefire matrix green; connectedDebugAndroidTest on the API 33 emulator green with zero failures (capability-gated tests report as skipped, like XIncludeTest).

🤖 Generated with Claude Code

https://claude.ai/code/session_01MbfpcsKig16HfSe6jGhcvh

Add probe-once capability constants to AttackTestSupport (secure
processing, parser-attached schemas, XInclude, SAXParser.reset) and
gate the wrapper tests' platform-optional assertions on them instead of
failing where the platform default implementation does not support the
surface, notably Android. Tests of the DOM wrapper contract skip where
the platform DOM is left unwrapped, the newDefault* smoke tests assert
the degraded lookup instead of the removed FactoryConfigurationError,
and every SecureFactoriesSmokeTest method now carries the tag of the
JAXP factory it exercises, running it across the implementation matrix.

That wider matrix exposed the schema smoke tests asserting the stock
JDK's FEATURE_SECURE_PROCESSING default rather than the library's
contract; they now assert the wrapped SecureSchema product, the actual
schema securing observable.

Assisted-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MbfpcsKig16HfSe6jGhcvh
@garydgregory
garydgregory merged commit c365653 into apache:main Aug 30, 2026
17 checks passed
@ppkarwasz
ppkarwasz deleted the fix/android-test-capabilities branch August 30, 2026 20:01
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