refactor!: keep internal tester helpers off the generated locator API - #190
Conversation
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.
|
Merge main and resolve conflicts. Also make the commit and the PR titles a |
…ester-helpers # Conflicts: # shared/src/main/java/com/vaadin/flow/component/textfield/TextAreaTester.java
|
@mcollovati Done — Merge. One conflict, in Titles. The PR title is now Also corrected the generated-locator entry in the API-changes section, which listed a Verification. Full |
Summary
CheckboxGroupTester.updateSelectionwas public, so the annotation processor copied it onto the generatedCheckboxGroupLocator. 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 nowprivate, andCheckboxGroupLocator.updateSelection(...)is gone from the generated locator. Anyone who called either method directly will no longer compile. UseselectItems(...)anddeselectItems(...)instead — they call the helper internally and run the usability check first.Why it was wrong to expose it:
BiConsumerthat decides whether to add or remove items — an implementation detail, not a user action.ensureComponentIsUsable().RadioButtonGroupTesteralready keeps its ownupdateSelectionprivate, so this makes the two testers consistent.Also removed the unused private
hasValidation()/getValidationSupport()pair fromTextFieldTesterandTextAreaTester. Nothing called them, so this part has no effect on users.API Changes
com.vaadin.flow.component.checkbox.CheckboxGroupTester
com.vaadin.flow.component.checkbox.CheckboxGroupLocator
Test summary
CheckboxGroupLocatorhas noupdateSelectionmethodCheckboxGroupLocatorstill hasselectItemsselectItems/deselectItemsstill work after the helper became privateGeneratedAggregatorsTest.locatorDoesNotDelegateInternalTesterHelpers— covers rows 1 and 2.Deliberately untested: the deleted
hasValidation()/getValidationSupport()methods inTextFieldTesterandTextAreaTester. They were private and unreachable, so removing them cannot change behaviour.