blob: 9247e4ca744f6f2157d4b64d696414d4f1a8ac72 (
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
46
47
48
49
50
51
52
53
54
55
|
package com.vaadin.tests.design.nested;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
import org.junit.Before;
import org.junit.Test;
/**
* Test case for reading nested templates
*
* @author Vaadin Ltd
*/
public class ReadNestedTemplatesTest {
private MyDesignRoot root;
@Before
public void setUp() {
root = new MyDesignRoot();
}
@Test
public void rootContainsOneChild() {
assertThat(root.getComponentCount(), is(1));
assertThat(root.iterator().next(),
instanceOf(MyExtendedChildDesign.class));
}
@Test
public void rootContainsTwoGrandChildren() {
assertThat(root.childDesign.getComponentCount(), is(2));
}
@Test
public void childComponentIsNotNull() {
assertThat(root.childDesign, is(not(nullValue())));
}
@Test
public void childLabelIsNotNull() {
assertThat(root.childDesign.childLabel, is(not(nullValue())));
assertThat(root.childDesign.childLabel.getValue(), is("test content"));
}
@Test
public void childCustomComponentsIsNotNull() {
assertThat(root.childDesign.childCustomComponent, is(not(nullValue())));
assertThat(root.childDesign.childCustomComponent.getCaption(),
is("custom content"));
}
}
|