Package org.uispec4j

Source Code of org.uispec4j.AbstractSwingUIComponent

package org.uispec4j;

import org.uispec4j.assertion.Assertion;
import org.uispec4j.assertion.testlibrairies.AssertAdapter;

import javax.swing.*;

/**
* Base class for UIComponent implementations that wrap JComponent subclasses.
*/
public abstract class AbstractSwingUIComponent extends AbstractUIComponent implements TooltipComponent {

  public abstract JComponent getAwtComponent();

  public Assertion tooltipEquals(final String text) {
    return new Assertion() {
      public void check() {
        String actualText = getAwtComponent().getToolTipText();
        AssertAdapter.assertEquals(actualText, text);
      }
    };
  }

  public Assertion tooltipContains(final String text) {
    return new Assertion() {
      public void check() {
        String actualText = getAwtComponent().getToolTipText();
        AssertAdapter.assertNotNull("No tooltip set", actualText);
        AssertAdapter.assertTrue("Actual tooltip:" + actualText, actualText.contains(text));
      }
    };
  }
}
TOP

Related Classes of org.uispec4j.AbstractSwingUIComponent

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.