This is an automated email from the ASF dual-hosted git repository. mgrigorov pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git
commit aee1b5b679944b53365da16135a0d8a486e815a5 Author: Martin Tzvetanov Grigorov <[email protected]> AuthorDate: Sun Mar 8 07:47:19 2020 +0200 WICKET-6754 Add a test case --- .../java/org/apache/wicket/MarkupContainerTest.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/wicket-core/src/test/java/org/apache/wicket/MarkupContainerTest.java b/wicket-core/src/test/java/org/apache/wicket/MarkupContainerTest.java index 8be4fe8..73162cc 100644 --- a/wicket-core/src/test/java/org/apache/wicket/MarkupContainerTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/MarkupContainerTest.java @@ -29,6 +29,7 @@ import java.util.Iterator; import java.util.List; import java.util.Optional; import java.util.Random; +import java.util.stream.Collectors; import org.apache.commons.collections4.map.LinkedMap; import org.apache.wicket.core.util.lang.WicketObjects; @@ -1280,7 +1281,7 @@ public class MarkupContainerTest extends WicketTestCase * * @param iterator * the iterator to remove the children with - * @param numberOfChildrenToAdd + * @param numberOfChildrenToRemove * the number of children */ private void removeNChildren(Iterator<Component> iterator, int numberOfChildrenToRemove) @@ -1353,4 +1354,18 @@ public class MarkupContainerTest extends WicketTestCase assertThat(loginPage.streamChildren().filter(TextField.class::isInstance) .filter(c -> c.getId().equals("field")).findFirst().isPresent(), is(true)); } + + // https://issues.apache.org/jira/browse/WICKET-6754 + @Test + public void streamChildrenNestedContainer() { + WebMarkupContainer wmc = new WebMarkupContainer("parent"); + WebMarkupContainer wmc1 = new WebMarkupContainer("wmc1"); + wmc.add(wmc1); + WebMarkupContainer wmc1_2= new WebMarkupContainer("wmc1_2"); + wmc1.add(wmc1_2); + Label lbl2 = new Label("lbl2"); + wmc.add(lbl2); + List l = wmc.streamChildren().map(Component::getId).collect(Collectors.toList()); + assertEquals("[wmc1, wmc1_2, lbl2]", l.toString()); + } }
