⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textboxhandlerforrawtextcomponent.java

📁 基于Junit的 功能和单元测试的的测试工具。只支持Swing.
💻 JAVA
字号:
package org.uispec4j;

import junit.framework.Assert;
import org.uispec4j.assertion.Assertion;

import javax.swing.text.JTextComponent;

class TextBoxHandlerForRawTextComponent extends AbstractTextBoxHandlerForTextComponent {
  public TextBoxHandlerForRawTextComponent(JTextComponent textComponent) {
    super(textComponent);
  }

  public Assertion textIsEmpty() {
    return new Assertion() {
      public void check() {
        String actualText = jTextComponent.getText();
        Assert.assertTrue("Text should be empty but contains: " + actualText,
                          actualText.length() == 0);
      }
    };
  }

  public Assertion textEquals(final String text) {
    return "".equals(text) ? textIsEmpty() :
        new Assertion() {
          public void check() {
            Assert.assertEquals(text, jTextComponent.getText());
          }
        };
  }

  public void clickOnHyperlink(String link) {
    Assert.fail("This component does not support hyperlinks.");
  }

  public Assertion htmlEquals(String html) {
    return new Assertion() {
      public void check() {
        Assert.fail("This component does not support html.");
      }
    };
  }
}

⌨️ 快捷键说明

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