2 * Copyright 2000-2016 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.server.component.abstractfield;
18 import org.junit.Test;
20 import com.vaadin.tests.server.component.abstractcomponent.AbstractComponentDeclarativeTestBase;
21 import com.vaadin.ui.AbstractField;
24 * Abstract test class which contains tests for declarative format for
25 * properties that are common for AbstractField.
27 * It's an abstract so it's not supposed to be run as is. Instead each
28 * declarative test for a real component should extend it and implement abstract
29 * methods to be able to test the common properties. Components specific
30 * properties should be tested additionally in the subclasses implementations.
35 public abstract class AbstractFieldDeclarativeTest<T extends AbstractField<V>, V>
36 extends AbstractComponentDeclarativeTestBase<T> {
39 public void requiredDeserialization()
40 throws InstantiationException, IllegalAccessException {
41 boolean isRequired = true;
42 String design = String.format("<%s required-indicator-visible/>",
45 T component = getComponentClass().newInstance();
46 component.setRequiredIndicatorVisible(isRequired);
47 testRead(design, component);
48 testWrite(design, component);
52 public void tabIndexDeserialization()
53 throws InstantiationException, IllegalAccessException {
55 String design = String.format("<%s tabindex='%s'/>", getComponentTag(),
58 T component = getComponentClass().newInstance();
59 component.setTabIndex(tabIndex);
61 testRead(design, component);
62 testWrite(design, component);
65 public abstract void valueDeserialization()
66 throws InstantiationException, IllegalAccessException;
68 public abstract void readOnlyValue()
69 throws InstantiationException, IllegalAccessException;