1515 */
1616package com .vaadin .flow .component ;
1717
18+ import java .util .List ;
19+
1820import org .junit .AfterClass ;
1921import org .junit .Assert ;
2022import org .junit .BeforeClass ;
@@ -329,18 +331,15 @@ public void bindChildren_removeThrowsWhileBindingActive() {
329331 }
330332
331333 @ Test
332- public void addTypedCollection_allowsAddingListOfSubtypes () {
333- // Test the fix for GitHub issue - should compile and work
334+ public void add_typedCollectionOfSubtypes_addsAllChildren () {
334335 TestComponent container = new TestComponent ();
335-
336- // Create a List<TestComponent> (subtype of Component)
337- java .util .List <TestComponent > typedComponents = java .util .List
338- .of (new TestComponent ("comp1" ), new TestComponent ("comp2" ),
339- new TestComponent ("comp3" ));
340-
341- // This should now compile with Collection<? extends Component>
336+
337+ List <TestComponent > typedComponents = List .of (
338+ new TestComponent ("comp1" ), new TestComponent ("comp2" ),
339+ new TestComponent ("comp3" ));
340+
342341 container .add (typedComponents );
343-
342+
344343 assertEquals (3 , container .getChildren ().count ());
345344 assertEquals ("comp1" ,
346345 container .getChildren ().toList ().get (0 ).getId ().orElse (null ));
@@ -351,24 +350,20 @@ public void addTypedCollection_allowsAddingListOfSubtypes() {
351350 }
352351
353352 @ Test
354- public void removeTypedCollection_allowsRemovingListOfSubtypes () {
355- // Test the fix for GitHub issue - should compile and work
353+ public void remove_typedCollectionOfSubtypes_removesMatchingChildren () {
356354 TestComponent container = new TestComponent ();
357-
355+
358356 TestComponent comp1 = new TestComponent ("comp1" );
359357 TestComponent comp2 = new TestComponent ("comp2" );
360358 TestComponent comp3 = new TestComponent ("comp3" );
361-
359+
362360 container .add (comp1 , comp2 , comp3 );
363361 assertEquals (3 , container .getChildren ().count ());
364-
365- // Create a List<TestComponent> (subtype of Component)
366- java .util .List <TestComponent > typedComponents = java .util .List
367- .of (comp1 , comp2 );
368-
369- // This should now compile with Collection<? extends Component>
362+
363+ List <TestComponent > typedComponents = List .of (comp1 , comp2 );
364+
370365 container .remove (typedComponents );
371-
366+
372367 assertEquals (1 , container .getChildren ().count ());
373368 assertEquals ("comp3" ,
374369 container .getChildren ().toList ().get (0 ).getId ().orElse (null ));
0 commit comments