public class ComplexPanelTest extends GwtTestTest {
@Test
public void add() {
// Arrange
ComplexPanel panel = new FlowPanel();
RootPanel.get().add(panel);
assertTrue(panel.isAttached());
assertEquals(0, panel.getWidgetCount());
Button b1 = new Button();
assertFalse(b1.isAttached());
assertNull(b1.getParent());
// Act
panel.add(b1);
// Assert
assertTrue(b1.isAttached());
assertEquals(panel, b1.getParent());
assertEquals(1, panel.getWidgetCount());
assertEquals(b1, panel.getWidget(0));
assertEquals(0, panel.getWidgetIndex(b1));
}