aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/test/java/com/vaadin/tests/design/InnerClassDesignReadWriteTest.java
blob: e42a89e98dd2653068d9e0a2c3412fd3ac762b8a (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
package com.vaadin.tests.design;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

import org.junit.Test;

import com.vaadin.tests.design.InnerClassDesignReadWriteTest.Foo.StaticInnerInner;
import com.vaadin.tests.design.UPPERCASE.InUpperCasePackage;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.declarative.Design;

public class InnerClassDesignReadWriteTest {
    @Test
    public void testWritingAndReadingBackInnerClass() throws IOException {
        VerticalLayout vl = new VerticalLayout();
        vl.addComponent(new StaticInner());
        vl.addComponent(new StaticInnerInner());
        vl.addComponent(new InUpperCasePackage());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        Design.write(vl, baos);
        Design.read(new ByteArrayInputStream(baos.toByteArray()));
    }

    public static class StaticInner extends GridLayout {
    }

    public static class Foo {
        public static class StaticInnerInner extends HorizontalLayout {

        }
    }

}