Skip to content

Clean up the test mocks - #6156

Merged
BalusC merged 3 commits into
5.0from
mock_cleanup
Nov 11, 2026
Merged

BalusC merged 3 commits into
5.0from
mock_cleanup

Conversation

@BalusC

@BalusC BalusC commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Cleans up the test mocks in org.glassfish.mojarra.mock, in three commits:

  1. Remove the unused MockResultSet mocks. MockResultSet, MockResultSetMetaData and mock.model.BeanTestImpl are used by no test.
  2. Move the API component tests to jakartaee/faces. The JSF-era tests of jakarta.faces.component test API classes, which ship from jakartaee/faces since 5.0. Add the component tests moved from Mojarra jakartaee/faces#2273 adds them there, ported to Mockito. This commit removes them here, together with their helpers and the README under impl/src/test/java/jakarta/faces/component. testSelectItemsIterator tests the impl class SelectItemsIterator, so it stays here as SelectItemsIteratorTest, on Mockito.
  3. Replace MockBeanManager with Mockito. MockCDI.newBeanManager() returns a Mockito ELAwareBeanManager. CountingBeanManager becomes BeanManagerLookupCounter, which counts the lookups of a Mockito BeanManager. FacesLoggerTest and PartialVisitContextDepthTest no longer use MockFacesContext and MockApplication.

The mock package goes from 39 classes (7224 lines) to 35 classes (5552 lines). The remaining mocks emulate the runtime for JUnitFacesTestCaseBase, the FactoryFinder tests and the config tests, so they stay for now.

mvn clean test in impl: 925 tests, all green.

Draft until jakartaee/faces#2273 is merged, so that the moved tests exist in at least one repository at all times.

🤖 Generated with Claude Opus 5.5

BalusC and others added 3 commits November 10, 2026 11:55
MockResultSet, MockResultSetMetaData and mock.model.BeanTestImpl are
referenced by no test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The JSF-era tests of jakarta.faces.component (the UIComponent*TestCase
tree, NamingContainerTestCase, the seven tests under
jakarta/faces/component and their helpers) test API classes, which
ship from jakartaee/faces since 5.0. They move there, ported from
JUnitFacesTestCaseBase and the Mojarra mocks to Mockito.

testSelectItemsIterator tests the impl class SelectItemsIterator, so
it stays here as SelectItemsIteratorTest, on Mockito.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MockCDI.newBeanManager() hands out a Mockito ELAwareBeanManager with
the MockELResolver. CountingBeanManager becomes
BeanManagerLookupCounter, which counts the lookups of a Mockito
BeanManager. FacesLoggerTest and PartialVisitContextDepthTest move
from MockFacesContext and MockApplication to Mockito.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BalusC BalusC added this to the 5.0.0 milestone Nov 10, 2026
@BalusC
BalusC marked this pull request as ready for review November 11, 2026 12:36
@BalusC
BalusC merged commit 8c0c5de into 5.0 Nov 11, 2026
2 checks passed
@BalusC
BalusC deleted the mock_cleanup branch November 11, 2026 12: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