summaryrefslogtreecommitdiffstats
path: root/tests/server-side/com/vaadin/data/util/TestContainerHierarchicalWrapper.java
blob: ff6de50651137df3c6dc08a232662a7ec63aa874 (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
package com.vaadin.data.util;

import java.util.Collection;

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.server.ApplicationResource", "blah", true,
                expectedSize);

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

}