01: package org.uispec4j;
02:
03: import junit.framework.Assert;
04: import org.uispec4j.assertion.Assertion;
05:
06: import javax.swing.text.JTextComponent;
07:
08: class TextBoxHandlerForRawTextComponent extends
09: AbstractTextBoxHandlerForTextComponent {
10: public TextBoxHandlerForRawTextComponent(
11: JTextComponent textComponent) {
12: super (textComponent);
13: }
14:
15: public Assertion textIsEmpty() {
16: return new Assertion() {
17: public void check() {
18: String actualText = jTextComponent.getText();
19: Assert.assertTrue("Text should be empty but contains: "
20: + actualText, actualText.length() == 0);
21: }
22: };
23: }
24:
25: public Assertion textEquals(final String text) {
26: return "".equals(text) ? textIsEmpty() : new Assertion() {
27: public void check() {
28: Assert.assertEquals(text, jTextComponent.getText());
29: }
30: };
31: }
32:
33: public void clickOnHyperlink(String link) {
34: Assert.fail("This component does not support hyperlinks.");
35: }
36:
37: public Assertion htmlEquals(String html) {
38: return new Assertion() {
39: public void check() {
40: Assert.fail("This component does not support html.");
41: }
42: };
43: }
44: }
|