filterToOne

Returns a lazy handle to the single match that also satisfies matcher; it fails on use when the filtered set does not hold exactly one node.

onAllNodesOfType<JCheckBox>().filterToOne(SwingMatcher.isSelected()).assertExists()

Return

a handle that fails on use unless exactly one match survives.

Parameters

matcher

must leave exactly one match; it is applied on each use, so which node survives can change across recomposition.