textboxhandlerforrawtextcomponent.java
来自「基于Junit的 功能和单元测试的的测试工具。只支持Swing.」· Java 代码 · 共 44 行
JAVA
44 行
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 + =
减小字号Ctrl + -
显示快捷键?