void () { MockComponent label1 = new MockComponent("1"); MockComponent label2 = new MockComponent("2"); MockComponent label3 = new MockComponent("3"); MockComponent label4 = new MockComponent("4"); myPanel.add(label1); JPanel subPanel = new JPanel(); myPanel.add(subPanel); subPanel.add(label2); subPanel.add(label3); myPanel.add(label4); assertThat(getChildren()).containsExactly(label1, subPanel, label2, label3, label4); }