org.uispec4j.interception
Class BasicHandler

java.lang.Object
  extended by org.uispec4j.interception.BasicHandler

public class BasicHandler
extends java.lang.Object

Ready-to-use window interception handler, designed for simple dialogs.

Sample usage:


 WindowInterceptor
   .init(panel.getButton("Change value").triggerClick())
   .process(BasicHandler.init()
            .assertContainsText("Enter new value")
            .setText("13")
            .triggerButtonClick("OK"))
   .run();
 
The last call must be triggerButtonClick(String), which returns the created WindowHandler.

See Also:
WindowInterceptor

Method Summary
 BasicHandler assertContainsText(java.lang.String text)
          Checks that there is a text component in the dialog displaying the given text.
 BasicHandler assertTitleContains(java.lang.String expectedTitle)
          Checks the displayed title contains the given text.
 BasicHandler assertTitleEquals(java.lang.String expectedTitle)
          Checks the displayed title is the same as the given text.
 BasicHandler clickButton(java.lang.String buttonName)
          Clicks on a button given its displayed label.
static BasicHandler init()
          Starts the definition of the handler.
 BasicHandler setText(java.lang.String text)
          Enters a text value, provided that there is only one input text field in the dialog.
 WindowHandler triggerButtonClick(java.lang.String buttonName)
          Returns the created window handler with a trigger for clicking on a button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public static BasicHandler init()
Starts the definition of the handler.


assertContainsText

public BasicHandler assertContainsText(java.lang.String text)
Checks that there is a text component in the dialog displaying the given text.


assertTitleEquals

public BasicHandler assertTitleEquals(java.lang.String expectedTitle)
Checks the displayed title is the same as the given text.


assertTitleContains

public BasicHandler assertTitleContains(java.lang.String expectedTitle)
Checks the displayed title contains the given text.


clickButton

public BasicHandler clickButton(java.lang.String buttonName)
Clicks on a button given its displayed label. This method will throw an exception if no button with this text is found.


setText

public BasicHandler setText(java.lang.String text)
Enters a text value, provided that there is only one input text field in the dialog.


triggerButtonClick

public WindowHandler triggerButtonClick(java.lang.String buttonName)
Returns the created window handler with a trigger for clicking on a button.



Copyright © 2004-2010. All Rights Reserved.