01: package org.uispec4j;
02:
03: import org.uispec4j.utils.UIComponentFactory;
04: import org.uispec4j.utils.UnitTestCase;
05:
06: import javax.swing.*;
07:
08: public abstract class UIComponentTestCase extends UnitTestCase {
09:
10: public abstract void testGetComponentTypeName() throws Exception;
11:
12: public abstract void testGetDescription() throws Exception;
13:
14: public abstract void testFactory() throws Exception;
15:
16: public void testGetName() throws Exception {
17: UIComponent component = createComponent();
18: component.getAwtComponent().setName(null);
19: assertEquals(null, component.getName());
20: component.getAwtComponent().setName("name");
21: assertEquals("name", component.getName());
22: }
23:
24: protected abstract UIComponent createComponent();
25:
26: public static void checkFactory(JComponent jComponent,
27: Class expectedGuiComponent) {
28: UIComponent uiComponent = UIComponentFactory
29: .createUIComponent(jComponent);
30: assertNotNull(uiComponent);
31: assertTrue(expectedGuiComponent.isInstance(uiComponent));
32: }
33: }
|