diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-12-10 13:34:40 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-11 12:29:36 +0000 |
commit | ea0be1f8dcff35ea8c652d69cd286d952c09ae5a (patch) | |
tree | 0508ab17e015d95f9cdae419c98a6cad594e828d | |
parent | a89b97fe58d91e9f69cf413078c07a760ff10ae2 (diff) | |
download | vaadin-framework-ea0be1f8dcff35ea8c652d69cd286d952c09ae5a.tar.gz vaadin-framework-ea0be1f8dcff35ea8c652d69cd286d952c09ae5a.zip |
Create harness for testing standalone widgets (#13334)
Change-Id: I4cce45280c1b55f1c6e3efe7ea9485f2cf25d08a
13 files changed, 330 insertions, 157 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeatures.java index 94144b233d..8e1a80a830 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeatures.java @@ -20,19 +20,17 @@ import com.vaadin.annotations.Title; import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.ui.AbstractComponent; +import com.vaadin.tests.widgetset.client.grid.EscalatorBasicClientFeaturesWidget; +import com.vaadin.tests.widgetset.server.TestWidgetComponent; import com.vaadin.ui.UI; @Widgetset(TestingWidgetSet.NAME) @Title("Escalator basic client features") public class EscalatorBasicClientFeatures extends UI { - public class EscalatorTestComponent extends AbstractComponent { - // empty - } - @Override public void init(VaadinRequest request) { - setContent(new EscalatorTestComponent()); + setContent(new TestWidgetComponent( + EscalatorBasicClientFeaturesWidget.class)); } } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorUpdaterUi.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorUpdaterUi.java index 7e822e41ba..ef997b3cae 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorUpdaterUi.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorUpdaterUi.java @@ -18,18 +18,16 @@ package com.vaadin.tests.components.grid.basicfeatures; import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.ui.AbstractComponent; +import com.vaadin.tests.widgetset.client.grid.EscalatorBasicClientFeaturesWidget; +import com.vaadin.tests.widgetset.server.TestWidgetComponent; import com.vaadin.ui.UI; @Widgetset(TestingWidgetSet.NAME) public class EscalatorUpdaterUi extends UI { - public class EscalatorUpdaterTestComponent extends AbstractComponent { - // empty - } - @Override protected void init(VaadinRequest request) { - setContent(new EscalatorUpdaterTestComponent()); + setContent(new TestWidgetComponent( + EscalatorBasicClientFeaturesWidget.UpdaterLifetimeWidget.class)); } } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeatures.java index 175b5027ee..429f15bb47 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeatures.java @@ -18,7 +18,8 @@ package com.vaadin.tests.components.grid.basicfeatures; import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.ui.AbstractComponent; +import com.vaadin.tests.widgetset.client.grid.GridBasicClientFeaturesWidget; +import com.vaadin.tests.widgetset.server.TestWidgetComponent; import com.vaadin.ui.UI; /** @@ -30,12 +31,9 @@ import com.vaadin.ui.UI; @Widgetset(TestingWidgetSet.NAME) public class GridBasicClientFeatures extends UI { - public class GridTestComponent extends AbstractComponent { - } - @Override protected void init(VaadinRequest request) { - setContent(new GridTestComponent()); + setContent(new TestWidgetComponent(GridBasicClientFeaturesWidget.class)); } } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeaturesTest.java index 2d5d66d301..d0e076fd3b 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeaturesTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeaturesTest.java @@ -83,7 +83,7 @@ public abstract class GridBasicClientFeaturesTest extends GridBasicFeaturesTest if (composite) { // Composite requires the basic client features widget for subparts return ((TestBenchElement) findElement(By - .vaadin("//GridBasicClientFeaturesWidget"))) + .vaadin("//TestWidgetComponent"))) .wrap(GridElement.class); } else { return super.getGridElement(); diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridClientDataSources.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridClientDataSources.java index a307d4ce07..3f84d40b01 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridClientDataSources.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridClientDataSources.java @@ -18,19 +18,15 @@ package com.vaadin.tests.components.grid.basicfeatures; import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.ui.AbstractComponent; +import com.vaadin.tests.widgetset.client.grid.GridClientDataSourcesWidget; +import com.vaadin.tests.widgetset.server.TestWidgetComponent; import com.vaadin.ui.UI; @Widgetset(TestingWidgetSet.NAME) public class GridClientDataSources extends UI { - public static class GridClientDataSourcesComponent extends - AbstractComponent { - // empty - } - @Override protected void init(VaadinRequest request) { - setContent(new GridClientDataSourcesComponent()); + setContent(new TestWidgetComponent(GridClientDataSourcesWidget.class)); } } diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml index d23903f9db..8a02d91d2c 100644 --- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml @@ -19,5 +19,9 @@ class="com.vaadin.tests.widgetset.client.MockApplicationConnection"> <when-type-is class="com.vaadin.client.ApplicationConnection" /> </replace-with> + + <generate-with class="com.vaadin.tests.widgetset.rebind.TestWidgetRegistryGenerator"> + <when-type-is class="com.vaadin.tests.widgetset.client.TestWidgetConnector.TestWidgetRegistry" /> + </generate-with> </module> diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestWidgetConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/TestWidgetConnector.java new file mode 100644 index 0000000000..33a8956810 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/TestWidgetConnector.java @@ -0,0 +1,100 @@ +/* + * Copyright 2000-2014 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.tests.widgetset.client; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Element; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.annotations.OnStateChange; +import com.vaadin.client.metadata.Invoker; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.client.ui.SubPartAware; +import com.vaadin.shared.AbstractComponentState; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.TestWidgetComponent; + +@Connect(TestWidgetComponent.class) +public class TestWidgetConnector extends AbstractComponentConnector { + public static class SubPartAwareSimplePanel extends SimplePanel implements + SubPartAware { + @Override + public Element getSubPartElement(String subPart) { + Widget target = getWidget(); + if (target instanceof SubPartAware) { + return ((SubPartAware) target).getSubPartElement(subPart); + } else { + return null; + } + } + + @Override + public String getSubPartName(Element subElement) { + Widget target = getWidget(); + if (target instanceof SubPartAware) { + return ((SubPartAware) target).getSubPartName(subElement); + + } else { + return null; + } + } + + } + + public static class TestWidgetState extends AbstractComponentState { + public String widgetClass; + } + + private final TestWidgetRegistry registry = GWT + .create(TestWidgetRegistry.class); + + public static abstract class TestWidgetRegistry { + private Map<String, Invoker> creators = new HashMap<String, Invoker>(); + + // Called by generated sub class + protected void register(String widgetClass, Invoker creator) { + creators.put(widgetClass, creator); + } + + public Widget createWidget(String widgetClass) { + Invoker invoker = creators.get(widgetClass); + if (invoker == null) { + return new Label("Widget not found: " + widgetClass); + } else { + return (Widget) invoker.invoke(null); + } + } + } + + @OnStateChange("widgetClass") + private void updateWidgetClass() { + getWidget().setWidget(registry.createWidget(getState().widgetClass)); + } + + @Override + public TestWidgetState getState() { + return (TestWidgetState) super.getState(); + } + + @Override + public SubPartAwareSimplePanel getWidget() { + return (SubPartAwareSimplePanel) super.getWidget(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesConnector.java deleted file mode 100644 index f065d4c7f6..0000000000 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesConnector.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2014 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.tests.widgetset.client.grid; - -import com.vaadin.client.ui.AbstractComponentConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeatures.EscalatorTestComponent; - -/** - * Connector for the EscalatorClientBasicFeatures ApplicationWidget - * - * @since - * @author Vaadin Ltd - */ -@Connect(EscalatorTestComponent.class) -public class EscalatorBasicClientFeaturesConnector extends - AbstractComponentConnector { - - @Override - public EscalatorBasicClientFeaturesWidget getWidget() { - return (EscalatorBasicClientFeaturesWidget) super.getWidget(); - } - -} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorUpdaterTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorUpdaterTestConnector.java deleted file mode 100644 index 4ef8972e4f..0000000000 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorUpdaterTestConnector.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 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.tests.widgetset.client.grid; - -import com.vaadin.client.ui.AbstractComponentConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.tests.components.grid.basicfeatures.EscalatorUpdaterUi.EscalatorUpdaterTestComponent; - -@Connect(EscalatorUpdaterTestComponent.class) -public class EscalatorUpdaterTestConnector extends AbstractComponentConnector { - - @Override - public EscalatorBasicClientFeaturesWidget.UpdaterLifetimeWidget getWidget() { - return (EscalatorBasicClientFeaturesWidget.UpdaterLifetimeWidget) super - .getWidget(); - } -} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesConnector.java deleted file mode 100644 index b0841b69fb..0000000000 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesConnector.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2014 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.tests.widgetset.client.grid; - -import com.vaadin.client.ui.AbstractComponentConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeatures.GridTestComponent; - -/** - * Connector for the GridClientBasicFeatures ApplicationWidget - * - * @since - * @author Vaadin Ltd - */ -@Connect(GridTestComponent.class) -public class GridBasicClientFeaturesConnector extends - AbstractComponentConnector { - - @Override - public GridBasicClientFeaturesWidget getWidget() { - return (GridBasicClientFeaturesWidget) super.getWidget(); - } - -} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientDataSourcesConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientDataSourcesConnector.java deleted file mode 100644 index 157fa18b0e..0000000000 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientDataSourcesConnector.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2000-2014 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.tests.widgetset.client.grid; - -import com.vaadin.client.ui.AbstractComponentConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.tests.components.grid.basicfeatures.GridClientDataSources.GridClientDataSourcesComponent; - -@Connect(GridClientDataSourcesComponent.class) -public class GridClientDataSourcesConnector extends AbstractComponentConnector { - @Override - public GridClientDataSourcesWidget getWidget() { - return (GridClientDataSourcesWidget) super.getWidget(); - } -} diff --git a/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java b/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java new file mode 100644 index 0000000000..1bdbba2c36 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java @@ -0,0 +1,144 @@ +/* + * Copyright 2000-2014 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.tests.widgetset.rebind; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; + +import com.google.gwt.core.ext.Generator; +import com.google.gwt.core.ext.GeneratorContext; +import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.typeinfo.JClassType; +import com.google.gwt.core.ext.typeinfo.TypeOracle; +import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; +import com.google.gwt.user.rebind.SourceWriter; +import com.vaadin.client.metadata.Invoker; +import com.vaadin.tests.widgetset.client.TestWidgetConnector; +import com.vaadin.tests.widgetset.client.TestWidgetConnector.TestWidgetRegistry; + +public class TestWidgetRegistryGenerator extends Generator { + + @Override + public String generate(TreeLogger logger, GeneratorContext context, + String typeName) throws UnableToCompleteException { + + try { + TypeOracle typeOracle = context.getTypeOracle(); + + // get classType and save instance variables + JClassType classType = typeOracle.getType(typeName); + String packageName = classType.getPackage().getName(); + String className = classType.getSimpleSourceName() + "Impl"; + + // Generate class source code + generateClass(packageName, className, logger, context); + return packageName + "." + className; + } catch (Exception e) { + logger.log(TreeLogger.ERROR, + "Accept criterion factory creation failed", e); + throw new UnableToCompleteException(); + } + // return the fully qualifed name of the class generated + } + + private void generateClass(String packageName, String className, + TreeLogger logger, GeneratorContext context) { + PrintWriter printWriter = context.tryCreate(logger, packageName, + className); + // print writer if null, source code has ALREADY been generated + if (printWriter == null) { + return; + } + + // init composer, set class properties, create source writer + ClassSourceFileComposerFactory composer = null; + composer = new ClassSourceFileComposerFactory(packageName, className); + + composer.setSuperclass(TestWidgetRegistry.class.getCanonicalName()); + + List<JClassType> testWidgets = findTestWidgets(logger, + context.getTypeOracle()); + + SourceWriter w = composer.createSourceWriter(context, printWriter); + + w.println("public %s() {", className); + w.indent(); + + w.println("super();"); + w.println(); + + for (JClassType testWidgetType : testWidgets) { + w.println("register(\"%s\", new %s() {", + escape(testWidgetType.getQualifiedSourceName()), + Invoker.class.getCanonicalName()); + w.indent(); + + w.println("public Object invoke(Object target, Object... params) {"); + w.indent(); + + w.println("return new %s();", + testWidgetType.getQualifiedSourceName()); + + w.outdent(); + w.println("}"); + + w.outdent(); + w.println("});"); + w.println(); + } + + // Close constructor + w.outdent(); + w.println("}"); + + // Close class body + w.outdent(); + w.println("}"); + + // commit generated class + context.commit(logger, printWriter); + } + + private List<JClassType> findTestWidgets(TreeLogger logger, + TypeOracle typeOracle) { + List<JClassType> testWidgetTypes = new ArrayList<JClassType>(); + + JClassType[] widgetTypes = typeOracle.findType(Widget.class.getName()) + .getSubtypes(); + for (JClassType widgetType : widgetTypes) { + if (isTestWidget(widgetType)) { + testWidgetTypes.add(widgetType); + } + } + + return testWidgetTypes; + } + + private boolean isTestWidget(JClassType widgetType) { + if (widgetType.isAbstract()) { + return false; + } else if (!widgetType.getPackage().getName() + .startsWith(TestWidgetConnector.class.getPackage().getName())) { + return false; + } + + return true; + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/TestWidgetComponent.java b/uitest/src/com/vaadin/tests/widgetset/server/TestWidgetComponent.java new file mode 100644 index 0000000000..1750e99727 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/TestWidgetComponent.java @@ -0,0 +1,67 @@ +/* + * Copyright 2000-2014 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.tests.widgetset.server; + +import com.google.gwt.user.client.ui.Widget; +import com.vaadin.annotations.Widgetset; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.client.TestWidgetConnector; +import com.vaadin.tests.widgetset.client.TestWidgetConnector.TestWidgetState; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.UI; + +/** + * Testing component that shows any widget class inside the + * com.vaadin.tests.widgetset.client package. + */ +public class TestWidgetComponent extends AbstractComponent { + private static final String targetPackage = TestWidgetConnector.class + .getPackage().getName(); + + public TestWidgetComponent(Class<? extends Widget> widgetClass) { + String className = widgetClass.getCanonicalName(); + if (!className.startsWith(targetPackage)) { + throw new IllegalArgumentException( + "Widget class must be inside the " + targetPackage + + " package"); + } + + getState().widgetClass = className; + setSizeFull(); + } + + @Override + public void attach() { + super.attach(); + + Class<? extends UI> uiClass = getUI().getClass(); + + Widgetset widgetset = uiClass.getAnnotation(Widgetset.class); + if (widgetset == null + || !widgetset.value().equals(TestingWidgetSet.NAME)) { + throw new IllegalStateException("You must add @" + + Widgetset.class.getSimpleName() + "(" + + TestingWidgetSet.class.getSimpleName() + ".NAME) to " + + uiClass.getSimpleName()); + } + } + + @Override + protected TestWidgetState getState() { + return (TestWidgetState) super.getState(); + } + +} |