uicomponenttestcase.java

来自「基于Junit的 功能和单元测试的的测试工具。只支持Swing.」· Java 代码 · 共 32 行

JAVA
32
字号
package org.uispec4j;

import org.uispec4j.utils.UIComponentFactory;
import org.uispec4j.utils.UnitTestCase;

import javax.swing.*;

public abstract class UIComponentTestCase extends UnitTestCase {

  public abstract void testGetComponentTypeName() throws Exception;

  public abstract void testGetDescription() throws Exception;

  public abstract void testFactory() throws Exception;

  public void testGetName() throws Exception {
    UIComponent component = createComponent();
    component.getAwtComponent().setName(null);
    assertEquals(null, component.getName());
    component.getAwtComponent().setName("name");
    assertEquals("name", component.getName());
  }

  protected abstract UIComponent createComponent();

  public static void checkFactory(JComponent jComponent, Class expectedGuiComponent) {
    UIComponent uiComponent = UIComponentFactory.createUIComponent(jComponent);
    assertNotNull(uiComponent);
    assertTrue(expectedGuiComponent.isInstance(uiComponent));
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?