Code example for ViewGroup

Methods: getChildAtgetChildCountremoveViewAt

0
        assertThat(root.getLayoutAnimation()).isSameAs(layoutAnim);
    } 
 
    @Test 
    public void testRemoveChildAt() throws Exception { 
        root.removeViewAt(1);
 
        assertThat(root.getChildCount()).isEqualTo(2);
        assertThat(root.getChildAt(0)).isSameAs(child1);
        assertThat(root.getChildAt(1)).isSameAs((View) child3);
 
        assertThat(child2.getParent()).isNull();
    } 
 
    @Test 
    public void testAddViewAt() throws Exception { 
        root.removeAllViews();
        root.addView(child1);
        root.addView(child2);
        root.addView(child3, 1);
        assertThat(root.getChildAt(0)).isSameAs(child1);