summaryrefslogtreecommitdiffstats
path: root/tests/server-side/com/vaadin/data/util/TestContainerHierarchicalWrapper.java
blob: ebe604ff3aac5c144c113b3f972dd060a8621591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.vaadin.data.util;

import java.util.Collection;

import com.vaadin.data.util.ContainerHierarchicalWrapper;
import com.vaadin.data.util.IndexedContainer;

public class TestContainerHierarchicalWrapper extends
        AbstractHierarchicalContainerTest {

    public void testBasicOperations() {
        testBasicContainerOperations(new ContainerHierarchicalWrapper(
                new IndexedContainer()));
    }

    public void testHierarchicalContainer() {
        testHierarchicalContainer(new ContainerHierarchicalWrapper(
                new IndexedContainer()));
    }

    public void testRemoveSubtree() {
        testRemoveHierarchicalWrapperSubtree(new ContainerHierarchicalWrapper(
                new IndexedContainer()));
    }

    protected void testRemoveHierarchicalWrapperSubtree(
            ContainerHierarchicalWrapper container) {
        initializeContainer(container);

        // remove root item
        container.removeItemRecursively("org");

        int packages = 21 + 3 - 3;
        int expectedSize = sampleData.length + packages - 1;

        validateContainer(container, "com", "com.vaadin.util.SerializerHelper",
                "com.vaadin.terminal.ApplicationResource", "blah", true,
                expectedSize);

        // rootItemIds
        Collection<?> rootIds = container.rootItemIds();
        assertEquals(1, rootIds.size());
    }

}