Skip to content

refactor!: keep internal tester helpers off the generated locator API - #190

Merged
mcollovati merged 2 commits into
mainfrom
chore/hide-internal-tester-helpers
Sep 14, 2026
Merged

refactor!: keep internal tester helpers off the generated locator API#190
mcollovati merged 2 commits into
mainfrom
chore/hide-internal-tester-helpers

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

CheckboxGroupTester.updateSelection was public, so the annotation processor copied it onto the generated CheckboxGroupLocator. It is an internal helper that models nothing a user does, so it is now private and no longer appears on the locator API. Two unused private methods in the text field testers are also deleted.

What changed

Breaking: CheckboxGroupTester.updateSelection(Collection<String>, BiConsumer<Collection<V>, Collection<V>>) is now private, and CheckboxGroupLocator.updateSelection(...) is gone from the generated locator. Anyone who called either method directly will no longer compile. Use selectItems(...) and deselectItems(...) instead — they call the helper internally and run the usability check first.

Why it was wrong to expose it:

  • It takes a BiConsumer that decides whether to add or remove items — an implementation detail, not a user action.
  • It was the only generated locator method that mapped to nothing a real user does.
  • It was the only public tester method there that skipped ensureComponentIsUsable().

RadioButtonGroupTester already keeps its own updateSelection private, so this makes the two testers consistent.

Also removed the unused private hasValidation() / getValidationSupport() pair from TextFieldTester and TextAreaTester. Nothing called them, so this part has no effect on users.

API Changes

com.vaadin.flow.component.checkbox.CheckboxGroupTester

// Removed
public void updateSelection(Collection<String> selection, BiConsumer<Collection<V>, Collection<V>> updater) // now private; internal helper behind selectItems/deselectItems

com.vaadin.flow.component.checkbox.CheckboxGroupLocator

// Removed
void updateSelection(Collection<String> selection, BiConsumer<Collection<V>, Collection<V>> updater) // generated delegate dropped, since the tester method is no longer public

Test summary

# Status What the test verifies Why it matters
1 CheckboxGroupLocator has no updateSelection method This is the whole point of the change: the internal helper must stay off the generated locator API.
2 CheckboxGroupLocator still has selectItems Guards against the fix going too far and hiding the real user-facing methods too.
3 gap selectItems / deselectItems still work after the helper became private Existing checkbox group tester tests cover this indirectly, but no test was added or changed here for it.
  • GeneratedAggregatorsTest.locatorDoesNotDelegateInternalTesterHelpers — covers rows 1 and 2.

Deliberately untested: the deleted hasValidation() / getValidationSupport() methods in TextFieldTester and TextAreaTester. They were private and unreachable, so removing them cannot change behaviour.

updateSelection is an internal helper — it takes a BiConsumer to decide
whether to add or remove items — but it was public, so LocatorProcessor
delegated it onto CheckboxGroupLocator. It was the only method on the
generated locators that models nothing a user does, and the only public
tester method there that skips ensureComponentIsUsable(). Making it
private (as RadioButtonGroupTester already does with its own
updateSelection) drops it from the generated locator.

Also delete the unused private hasValidation()/getValidationSupport()
pair from TextFieldTester and TextAreaTester.
@mcollovati

Copy link
Copy Markdown
Contributor

Merge main and resolve conflicts. Also make the commit and the PR titles a refactor instead of chore and mark them as breaking change

…ester-helpers

# Conflicts:
#	shared/src/main/java/com/vaadin/flow/component/textfield/TextAreaTester.java
@totally-not-ai totally-not-ai Bot changed the title chore: keep internal tester helpers off the generated locator API refactor!: keep internal tester helpers off the generated locator API Sep 14, 2026
@totally-not-ai

Copy link
Copy Markdown
Contributor Author

@mcollovati Done — main is merged and the titles are updated.

Merge. One conflict, in TextAreaTester: main added clear() / clickClearButton() in the same spot this branch deleted the dead hasValidation() / getValidationSupport() pair. Resolved by keeping both new methods and dropping the dead pair. TextFieldTester and CheckboxGroupTester merged cleanly. The net diff against main is unchanged in substance: updateSelection private, the two dead private methods gone, one new locator test.

Titles. The PR title is now refactor!: keep internal tester helpers off the generated locator API, and the description carries a BREAKING CHANGE: footer naming the removed method and its replacements. Since this repo squash-merges with the PR title and body as the commit message, that is what lands on main. The branch's own commit still reads chore: — rewording it would mean force-pushing over what is already pushed here, so I left it; the squash commit is the one that ends up in the history.

Also corrected the generated-locator entry in the API-changes section, which listed a String id parameter the generated delegate never had.

Verification. Full mvn verify on the merge result: shared, junit6 (1224 tests), the CDI module and quarkus all green. Two failures in SpringPageTitleGeneratorTest (pageTitleGeneratorBean_resolvesTitleOfViewWithPageTitleValue and ...WithoutPageTitle) — these reproduce on a clean checkout of main at 897ea56 with the same expected/actual values, so they are pre-existing and unrelated to this branch. spotless:check passes.

@mcollovati
mcollovati merged commit 40c3ce7 into main Sep 14, 2026
6 checks passed
@mcollovati
mcollovati deleted the chore/hide-internal-tester-helpers branch September 14, 2026 13:04
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