diff options
author | Artur Signell <artur@vaadin.com> | 2013-03-12 12:58:05 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-03-12 12:58:07 +0200 |
commit | 0f3ac51ed4c34c9233463c1274c7107580faa1f9 (patch) | |
tree | 11a1de6982ca79c96c787cf395fe4f1fc51deeb9 /server/tests | |
parent | 1853dea1b9277f2d5a8911bd2d20277158e221b7 (diff) | |
parent | 6922bc5b49c5551b289a5025ccd5901e2ac3aafc (diff) | |
download | vaadin-framework-0f3ac51ed4c34c9233463c1274c7107580faa1f9.tar.gz vaadin-framework-0f3ac51ed4c34c9233463c1274c7107580faa1f9.zip |
Merge commit '6922bc5b49c5551b289a5025ccd5901e2ac3aafc'
Change-Id: Id118fd9bae1fdf7e7ce2efd660ade5ba7bbc5109
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java | 71 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java | 5 |
2 files changed, 74 insertions, 2 deletions
diff --git a/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java b/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java new file mode 100644 index 0000000000..a01c2dea8f --- /dev/null +++ b/server/tests/src/com/vaadin/data/fieldgroup/BeanFieldGroupTest.java @@ -0,0 +1,71 @@ +/* + * Copyright 2012 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.data.fieldgroup; + +import junit.framework.Assert; + +import org.junit.Test; + +public class BeanFieldGroupTest { + + class Main { + private String mainField; + + public String getMainField() { + return mainField; + } + + public void setMainField(String mainField) { + this.mainField = mainField; + } + + } + + class Sub1 extends Main { + private Integer sub1Field; + + public Integer getSub1Field() { + return sub1Field; + } + + public void setSub1Field(Integer sub1Field) { + this.sub1Field = sub1Field; + } + + } + + class Sub2 extends Sub1 { + private boolean sub2field; + + public boolean isSub2field() { + return sub2field; + } + + public void setSub2field(boolean sub2field) { + this.sub2field = sub2field; + } + + } + + @Test + public void propertyTypeWithoutItem() { + BeanFieldGroup<Sub2> s = new BeanFieldGroup<BeanFieldGroupTest.Sub2>( + Sub2.class); + Assert.assertEquals(boolean.class, s.getPropertyType("sub2field")); + Assert.assertEquals(Integer.class, s.getPropertyType("sub1Field")); + Assert.assertEquals(String.class, s.getPropertyType("mainField")); + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java index e02fafeaff..8884c0c27c 100644 --- a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java +++ b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java @@ -52,13 +52,14 @@ public class CustomUIClassLoader extends TestCase { * @throws Exception * if thrown */ - public void testWithNullClassLoader() throws Exception { + public void testWithDefaultClassLoader() throws Exception { VaadinSession application = createStubApplication(); application.setConfiguration(createConfigurationMock()); DefaultUIProvider uiProvider = new DefaultUIProvider(); Class<? extends UI> uiClass = uiProvider - .getUIClass(new UIClassSelectionEvent(createRequestMock(null))); + .getUIClass(new UIClassSelectionEvent( + createRequestMock(getClass().getClassLoader()))); assertEquals(MyUI.class, uiClass); } |