Skip to content

Conversation

snazy
Copy link
Member

@snazy snazy commented Sep 10, 2025

The above test asserts the the log record passed to org.jboss.logmanager.Logger#logRaw(org.jboss.logmanager.ExtLogRecord). For the sake of this test, both the IcebergJsonProcessingExceptionMapper and IcebergExceptionMapper have a visible-for-testing function getLogger() to provide a mocked logger. getLogger() however is used for "all the logging", which makes the behavior verify(JBOSS_LOGGER).logRaw(argThat(...)) "interesting" - the test fails with #2461 although no related dependencies have changed in that PR.

But eventually the test failure's caused by using getLogger() for all logging, which may provide the wrong log record and cause the test to fail.

This change renames the getLogger() functions to make their special meaning clear, and adds some clarifying comments in the code.

Also adding some more test cases for the various exception mapper code paths.

The above test asserts the the log record passed to `org.jboss.logmanager.Logger#logRaw(org.jboss.logmanager.ExtLogRecord)`. For the sake of this test, both the `IcebergJsonProcessingExceptionMapper` and `IcebergExceptionMapper` have a visible-for-testing function `getLogger()` to provide a mocked logger. `getLogger()` however is used for "all the logging", which makes the behavior `verify(JBOSS_LOGGER).logRaw(argThat(...))` "interesting" - the test fails with apache#2461 although no related dependencies have changed in that PR.

But eventually the test failure's caused by using `getLogger()` for all logging, which may provide the _wrong_ log record and cause the test to fail.

This change renames the `getLogger()` functions to make their special meaning clear, and adds some clarifying comments in the code.

Also adding some more test cases for the various exception mapper code paths.
adutra
adutra previously approved these changes Sep 10, 2025
@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Sep 10, 2025
…tion/IcebergExceptionMapper.java

Co-authored-by: Alexandre Dutra <[email protected]>
@snazy snazy merged commit c2e932b into apache:main Sep 11, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Sep 11, 2025
@snazy snazy deleted the fix-ExceptionMapperTest branch September 11, 2025 08:14
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.

3 participants