public final class TestUtils

  1. Object
  2. TestUtils
Various utility classes to automate UI testing

Methods

public static void setVerboseMode(boolean v)Activates/deactivates the verbose test mode
public static void waitFor(int millis)Waits for the given number of milliseconds even if the waiting is on the EDT thread
public static Component findByName(String componentName)Finds a component with the given name, works even with UI’s that weren’t created with the GUI builder
public static void selectInList(String listName, int offset)Selects the given offset in a list
public static void selectInList(int[] path, int offset)Selects the given offset in a list
public static Label findLabelText(String text)Finds a component with the given name, works even with UI’s that weren’t created with the GUI builder
public static void clickButtonByLabel(String text)Clicks the button with the given label
public static void clickButtonByName(String name)Clicks the button with the given label
public static void clickButtonByPath(int[] path)Clicks the button with the given component path
public static void goBack()Executes the back command for the current form, similarly to pressing the back button
public static void clickMenuItem(String name)Executes a menu command with the given name
public static Command[] getToolbarCommands()Returns all the command objects from the toolbar in the order of left, right, overflow & sidemenu
public static void showSidemenu()Shows the sidemenu UI
public static void executeToolbarCommandAtOffset(int offset)Executes a command from the offset returned by #getToolbarCommands()
public static void ensureVisible(Component c)Scrolls to show the component in case it is invisible currently
public static void ensureVisible(String componentName)Scrolls to show the component in case it is invisible currently
public static void ensureVisible(int[] path)Scrolls to show the component in case it is invisible currently
public static void waitForFormTitle(String title, long timeout)Waits for a form change and if no form change occurred after a given timeout then fail the test
public static void waitForFormTitle(String title)Waits for a form change and if no form change occurred after a given timeout then fail the test.
public static void waitForFormName(String name, long timeout)Waits for a form change and if no form change occurred after a given timeout then fail the test
public static void waitForFormName(String name)Waits for a form change and if no form change occurred after a given timeout then fail the test.
public static void waitForUnnamedForm(long timeout)Waits for a form change and if no form change occurred after a given timeout then fail the test
public static void waitForUnnamedForm()Waits for a form change and if no form change occurred after a given timeout then fail the test
public static boolean screenshotTest(String screenshotName)The screenshot test takes a screenshot of the screen and compares it to a prior screenshot, if both are 100% identical the test passes.
public static void log(String t)Log to the test log
public static void log(Throwable t)Log to the test log
public static void keyPress(int keyCode)Simulates a device key press
public static void keyRelease(int keyCode)Simulates a device key release
public static void gameKeyPress(int gameKey)Simulates a game key press
public static void gameKeyRelease(int gameKey)Simulates a game key release
public static void pointerPress(float x, float y, String componentName)A component press on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place.
public static void pointerRelease(float x, float y, String componentName)A component release on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place.
public static void pointerDrag(float x, float y, String componentName)A component drag on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place.
public static void pointerPress(float x, float y, int[] path)A component press on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place.
public static void pointerRelease(float x, float y, int[] path)A component release on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place.
public static void pointerDrag(float x, float y, int[] path)A component drag on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place.
public static Component getComponentByPath(int[] path)Gets the component from the current form based on its path.
public static void setText(String name, String text)Sets the text for the given component
public static void setText(int[] path, String text)Sets the text for the given component
public static void assertBool(boolean b)Assertions allow for simpler test code
public static void assertBool(boolean b, String errorMessage)Assertions allow for simpler test code
public static void fail()An assertion that always fails a test.
public static void fail(String errorMessage)An assertion that always fails a test.
public static void assertTrue(boolean value)Asserts that the given expression evaluates to true
public static void assertTrue(boolean value, String errorMessage)Asserts that the given expression evaluates to true
public static void assertFalse(boolean value)Asserts that the given expression evaluates to false
public static void assertFalse(boolean value, String errorMessage)Asserts that the given expression evaluates to false
public static void assertNull(Object object)Asserts that the given expression evaluates to null
public static void assertNull(Object object, String errorMessage)Asserts that the given expression evaluates to null
public static void assertNotNull(Object object)Asserts that the given expression does not evaluate to null
public static void assertNotNull(Object object, String errorMessage)Asserts that the given expression does not evaluate to null
public static void assertSame(Object expected, Object actual)Asserts that the given parameters reference the same object
public static void assertSame(Object expected, Object actual, String errorMessage)Asserts that the given parameters reference the same object
public static void assertNotSame(Object expected, Object actual)Asserts that the given parameters do not reference the same object
public static void assertNotSame(Object expected, Object actual, String errorMessage)Asserts that the given parameters do not reference the same object
public static void assertEqual(byte expected, byte actual)Asserts that the given bytes are equal
public static void assertEqual(byte expected, byte actual, String errorMessage)Asserts that the given bytes are equal
public static void assertEqual(short expected, short actual)Asserts that the given shorts are equal
public static void assertEqual(short expected, short actual, String errorMessage)Asserts that the given shorts are equal
public static void assertEqual(int expected, int actual)Asserts that the given ints are equal
public static void assertEqual(int expected, int actual, String errorMessage)Asserts that the given ints are equal
public static void assertEqual(long expected, long actual)Asserts that the given longs are equal
public static void assertEqual(long expected, long actual, String errorMessage)Asserts that the given longs are equal
public static void assertEqual(float expected, float actual, double maxRelativeError)Asserts that the given floats are equal
public static void assertEqual(float expected, float actual, double maxRelativeError, String errorMessage)Asserts that the given floats are equal
public static void assertEqual(double expected, double actual, double maxRelativeError)Asserts that the given doubles are equal
public static void assertRange(double expected, double actual, double absoluteError)Asserts that the given doubles are equal
public static void assertEqual(double expected, double actual, double maxRelativeError, String errorMessage)Asserts that the given doubles are equal
public static void assertRange(double expected, double actual, double maxAbsoluteError, String errorMessage)Asserts that the given doubles are equal
public static void assertEqual(Object expected, Object actual)Asserts that the given objects are equal using the first object’s .equal() method
public static void assertEqual(Object expected, Object actual, String errorMessage)Asserts that the given objects are equal using the first object’s .equal() method
public static void assertNotEqual(byte expected, byte actual)Asserts that the given bytes are not equal
public static void assertNotEqual(byte expected, byte actual, String errorMessage)Asserts that the given bytes are not equal
public static void assertNotEqual(short expected, short actual)Asserts that the given shorts are not equal
public static void assertNotEqual(short expected, short actual, String errorMessage)Asserts that the given shorts are not equal
public static void assertNotEqual(int expected, int actual)Asserts that the given ints are not equal
public static void assertNotEqual(int expected, int actual, String errorMessage)Asserts that the given ints are not equal
public static void assertNotEqual(long expected, long actual, double minRelativeError)Asserts that the given longs are not equal
public static void assertNotEqual(long expected, long actual, double minRelativeError, String errorMessage)Asserts that the given longs are not equal
public static void assertNotEqual(double expected, double actual, double minRelativeError)Asserts that the given doubles are not equal
public static void assertNotEqual(double expected, double actual, double minRelativeError, String errorMessage)Asserts that the given doubles are not equal
public static void assertNotEqual(Object expected, Object actual)Asserts that the given objects are not equal using the first object’s .equal() method
public static void assertNotEqual(Object expected, Object actual, String errorMessage)Asserts that the given objects are not equal using the first object’s .equal() method
public static void assertArrayEqual(byte[] expected, byte[] actual)Asserts that the given byte arrays are equal
public static void assertArrayEqual(byte[] expected, byte[] actual, String errorMessage)Asserts that the given byte arrays are equal
public static void assertArrayEqual(short[] expected, short[] actual)Asserts that the given short arrays are equal
public static void assertArrayEqual(short[] expected, short[] actual, String errorMessage)Asserts that the given short arrays are equal
public static void assertArrayEqual(int[] expected, int[] actual)Asserts that the given int arrays are equal
public static void assertArrayEqual(int[] expected, int[] actual, String errorMessage)Asserts that the given int arrays are equal
public static void assertArrayEqual(long[] expected, long[] actual, double maxRelativeError)Asserts that the given long arrays are equal
public static void assertArrayEqual(long[] expected, long[] actual, double maxRelativeError, String errorMessage)Asserts that the given long arrays are equal
public static void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError)Asserts that the given float arrays are equal
public static void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError, String errorMessage)Asserts that the given double arrays are equal
public static void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError)Asserts that the given double arrays are equal
public static void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError, String errorMessage)Asserts that the given double arrays are equal
public static void assertArrayEqual(Object[] expected, Object[] actual)Asserts that the given object arrays are equal
public static void assertArrayEqual(Object[] expected, Object[] actual, String errorMessage)Asserts that the given object arrays are equal
public static void assertException(RuntimeException exception, Runnable expression)Asserts that a certain exception is raised
public static void assertException(RuntimeException exception, Runnable expression, String errorMessage)Asserts that a certain exception is raised
public static void assertNoException(Runnable expression)Asserts that no exception is raised
public static void assertNoException(Runnable expression, String errorMessage)Asserts that no exception is raised
public static void assertTitle(String title)Verifies the current title is the same otherwise throws an exception
public static void assertLabel(String name, String text)Asserts that we have a label with the given text baring the given name
public static void assertLabel(int[] path, String text)Asserts that we have a label with the given text baring the given name
public static void assertLabel(String text)Asserts that we have a label with the given text baring the given name
public static void assertTextArea(String name, String text)Asserts that we have a TextArea with the given text and the given name
public static void assertTextAreaContaining(String name, String text)Asserts that we have a TextArea with the a text contains the given text and with the given name
public static void assertTextAreaStartingWith(String name, String text)Asserts that we have a TextArea with the a text starting with the given text and with the given name
public static void assertTextAreaEndingWith(String name, String text)Asserts that we have a TextArea with the a text ending with the given text and with the given name
public static void assertTextArea(int[] path, String text)Asserts that we have a label with the given text baring the given name
public static void assertTextArea(String text)Asserts that we have a label with the given text baring the given name
public static TextArea findTextAreaText(String text)Finds a component with the given name, works even with UI’s that weren’t created with the GUI builder

Inherited methods

Method details

setVerboseMode

public static void setVerboseMode(boolean v)
Activates/deactivates the verbose test mode

Parameters

v boolean
true for verbosity

waitFor

public static void waitFor(int millis)
Waits for the given number of milliseconds even if the waiting is on the EDT thread

Parameters

millis int
the number of milliseconds to wait

findByName

public static Component findByName(String componentName)
Finds a component with the given name, works even with UI’s that weren’t created with the GUI builder

Parameters

componentName String
the name of the component to find

Returns

the component with the given name within the tree

selectInList

public static void selectInList(String listName, int offset)
Selects the given offset in a list

Parameters

listName String
the name of the list component
offset int
the offset to select

selectInList

public static void selectInList(int[] path, int offset)
Selects the given offset in a list

Parameters

path int[]
Not documented.
offset int
the offset to select

findLabelText

public static Label findLabelText(String text)
Finds a component with the given name, works even with UI’s that weren’t created with the GUI builder

Parameters

text String
the text of the label/button

Returns

the component with the given label text within the tree

clickButtonByLabel

public static void clickButtonByLabel(String text)
Clicks the button with the given label

Parameters

text String
the text on the button

clickButtonByName

public static void clickButtonByName(String name)
Clicks the button with the given label

Parameters

name String
the name of the button

clickButtonByPath

public static void clickButtonByPath(int[] path)
Clicks the button with the given component path

Parameters

path int[]
the path

goBack

public static void goBack()
Executes the back command for the current form, similarly to pressing the back button

clickMenuItem

public static void clickMenuItem(String name)
Executes a menu command with the given name

Parameters

name String
the name of the command

getToolbarCommands

public static Command[] getToolbarCommands()
Returns all the command objects from the toolbar in the order of left, right, overflow & sidemenu

Returns

the set of commands

showSidemenu

public static void showSidemenu()
Shows the sidemenu UI

executeToolbarCommandAtOffset

public static void executeToolbarCommandAtOffset(int offset)
Executes a command from the offset returned by #getToolbarCommands()

Parameters

offset int
the offset of the command we want to execute

ensureVisible

public static void ensureVisible(Component c)
Scrolls to show the component in case it is invisible currently

Parameters

c Component
the component

ensureVisible

public static void ensureVisible(String componentName)
Scrolls to show the component in case it is invisible currently

Parameters

componentName String
the component

ensureVisible

public static void ensureVisible(int[] path)
Scrolls to show the component in case it is invisible currently

Parameters

path int[]
the path to the component

waitForFormTitle

public static void waitForFormTitle(String title, long timeout)
Waits for a form change and if no form change occurred after a given timeout then fail the test

Parameters

title String
the title of the form to wait for
timeout long
Timeout in ms.

waitForFormTitle

public static void waitForFormTitle(String title)
Waits for a form change and if no form change occurred after a given timeout then fail the test. Timeout is 90 seconds.

Parameters

title String
the title of the form to wait for

waitForFormName

public static void waitForFormName(String name, long timeout)
Waits for a form change and if no form change occurred after a given timeout then fail the test

Parameters

name String
the name of the form to wait for
timeout long
Timeout in ms

waitForFormName

public static void waitForFormName(String name)
Waits for a form change and if no form change occurred after a given timeout then fail the test. Timeout is 90 seconds.

Parameters

name String
the name of the form to wait for

waitForUnnamedForm

public static void waitForUnnamedForm(long timeout)
Waits for a form change and if no form change occurred after a given timeout then fail the test

Parameters

timeout long
Timeout in milliseconds.

waitForUnnamedForm

public static void waitForUnnamedForm()
Waits for a form change and if no form change occurred after a given timeout then fail the test

screenshotTest

public static boolean screenshotTest(String screenshotName)

The screenshot test takes a screenshot of the screen and compares it to a prior screenshot, if both are 100% identical the test passes. If not the test fails.

If this is the first time the test is run then the screenshot is taken and saved under the given name in the devices storage. The test passes for this case but a warning is printed to the console. The name will have .png appended to it so it will be identified.

This test will only work on devices that support the ImageIO API with PNG file format.

Parameters

screenshotName String
the name to use for the storage, must be unique!

Returns

true if the screenshots are identical or no prior screenshot exists or if the test can’t be run on this device. False if a screenshot exists and it isn’t 100% identical.

log

public static void log(String t)
Log to the test log

Parameters

t String
the string to log

log

public static void log(Throwable t)
Log to the test log

Parameters

t Throwable
exception to log

keyPress

public static void keyPress(int keyCode)
Simulates a device key press

Parameters

keyCode int
the keycode

keyRelease

public static void keyRelease(int keyCode)
Simulates a device key release

Parameters

keyCode int
the keycode

gameKeyPress

public static void gameKeyPress(int gameKey)
Simulates a game key press

Parameters

gameKey int
the game key (arrows etc.)

gameKeyRelease

public static void gameKeyRelease(int gameKey)
Simulates a game key release

Parameters

gameKey int
the game key (arrows etc.)

pointerPress

public static void pointerPress(float x, float y, String componentName)
A component press on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.

Parameters

x float
the offset within the component as a number between 0 and 1
y float
the offset within the component as a number between 0 and 1
componentName String
the name of the component

pointerRelease

public static void pointerRelease(float x, float y, String componentName)
A component release on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.

Parameters

x float
the offset within the component as a number between 0 and 1
y float
the offset within the component as a number between 0 and 1
componentName String
the name of the component

pointerDrag

public static void pointerDrag(float x, float y, String componentName)
A component drag on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.

Parameters

x float
the offset within the component as a number between 0 and 1
y float
the offset within the component as a number between 0 and 1
componentName String
the name of the component

pointerPress

public static void pointerPress(float x, float y, int[] path)
A component press on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.

Parameters

x float
the offset within the component as a number between 0 and 1
y float
the offset within the component as a number between 0 and 1
path int[]
the path to the component

pointerRelease

public static void pointerRelease(float x, float y, int[] path)
A component release on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.

Parameters

x float
the offset within the component as a number between 0 and 1
y float
the offset within the component as a number between 0 and 1
path int[]
the path to the component

pointerDrag

public static void pointerDrag(float x, float y, int[] path)
A component drag on a given named component at x/y where x and y are NOT pixels but rather a number between 0 to 1 representing the percentage within the component where the event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.

Parameters

x float
the offset within the component as a number between 0 and 1
y float
the offset within the component as a number between 0 and 1
path int[]
the path to the component

getComponentByPath

public static Component getComponentByPath(int[] path)
Gets the component from the current form based on its path. A path is a set of offsets starting from the content pane and moving inwards so a path of { 0, 3 } would mean that the first component within the Content pane (by index) is a Container whose 3rd component (again by index) is the component we want.

Parameters

path int[]
an array

Returns

a component

setText

public static void setText(String name, String text)
Sets the text for the given component

Parameters

name String
the name of the component
text String
the text to set

setText

public static void setText(int[] path, String text)
Sets the text for the given component

Parameters

path int[]
the path to the component
text String
the text to set

assertBool

public static void assertBool(boolean b)
Assertions allow for simpler test code

Parameters

b boolean
must be true, otherwise an exception is thrown thus failing the test

assertBool

public static void assertBool(boolean b, String errorMessage)
Assertions allow for simpler test code

Parameters

b boolean
must be true, otherwise an exception is thrown thus failing the test
errorMessage String
Not documented.

fail

public static void fail()
An assertion that always fails a test.

fail

public static void fail(String errorMessage)
An assertion that always fails a test.

Parameters

errorMessage String
is a string describing the failure

assertTrue

public static void assertTrue(boolean value)
Asserts that the given expression evaluates to true

assertTrue

public static void assertTrue(boolean value, String errorMessage)
Asserts that the given expression evaluates to true

Parameters

value boolean
Not documented.
errorMessage String
is a string describing the failure

assertFalse

public static void assertFalse(boolean value)
Asserts that the given expression evaluates to false

assertFalse

public static void assertFalse(boolean value, String errorMessage)
Asserts that the given expression evaluates to false

Parameters

value boolean
Not documented.
errorMessage String
is a string describing the failure

assertNull

public static void assertNull(Object object)
Asserts that the given expression evaluates to null

assertNull

public static void assertNull(Object object, String errorMessage)
Asserts that the given expression evaluates to null

Parameters

object Object
Not documented.
errorMessage String
is a string describing the failure

assertNotNull

public static void assertNotNull(Object object)
Asserts that the given expression does not evaluate to null

assertNotNull

public static void assertNotNull(Object object, String errorMessage)
Asserts that the given expression does not evaluate to null

Parameters

object Object
Not documented.
errorMessage String
is a string describing the failure

assertSame

public static void assertSame(Object expected, Object actual)
Asserts that the given parameters reference the same object

assertSame

public static void assertSame(Object expected, Object actual, String errorMessage)
Asserts that the given parameters reference the same object

Parameters

expected Object
Not documented.
actual Object
Not documented.
errorMessage String
is a string describing the failure

assertNotSame

public static void assertNotSame(Object expected, Object actual)
Asserts that the given parameters do not reference the same object

assertNotSame

public static void assertNotSame(Object expected, Object actual, String errorMessage)
Asserts that the given parameters do not reference the same object

Parameters

expected Object
Not documented.
actual Object
Not documented.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(byte expected, byte actual)
Asserts that the given bytes are equal

assertEqual

public static void assertEqual(byte expected, byte actual, String errorMessage)
Asserts that the given bytes are equal

Parameters

expected byte
Not documented.
actual byte
Not documented.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(short expected, short actual)
Asserts that the given shorts are equal

assertEqual

public static void assertEqual(short expected, short actual, String errorMessage)
Asserts that the given shorts are equal

Parameters

expected short
Not documented.
actual short
Not documented.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(int expected, int actual)
Asserts that the given ints are equal

assertEqual

public static void assertEqual(int expected, int actual, String errorMessage)
Asserts that the given ints are equal

Parameters

expected int
Not documented.
actual int
Not documented.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(long expected, long actual)
Asserts that the given longs are equal

assertEqual

public static void assertEqual(long expected, long actual, String errorMessage)
Asserts that the given longs are equal

Parameters

expected long
Not documented.
actual long
Not documented.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(float expected, float actual, double maxRelativeError)
Asserts that the given floats are equal

Parameters

expected float
Not documented.
actual float
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.

assertEqual

public static void assertEqual(float expected, float actual, double maxRelativeError, String errorMessage)
Asserts that the given floats are equal

Parameters

expected float
Not documented.
actual float
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(double expected, double actual, double maxRelativeError)
Asserts that the given doubles are equal

Parameters

expected double
Not documented.
actual double
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.

assertRange

public static void assertRange(double expected, double actual, double absoluteError)
Asserts that the given doubles are equal

Parameters

expected double
Expected value
actual double
Actual value
absoluteError double
is the maximum allowed error, a value of 1 represents a 1% error.

assertEqual

public static void assertEqual(double expected, double actual, double maxRelativeError, String errorMessage)
Asserts that the given doubles are equal

Parameters

expected double
Not documented.
actual double
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertRange

public static void assertRange(double expected, double actual, double maxAbsoluteError, String errorMessage)
Asserts that the given doubles are equal

Parameters

expected double
Not documented.
actual double
Not documented.
maxAbsoluteError double
Not documented.
errorMessage String
is a string describing the failure

assertEqual

public static void assertEqual(Object expected, Object actual)
Asserts that the given objects are equal using the first object’s .equal() method

assertEqual

public static void assertEqual(Object expected, Object actual, String errorMessage)
Asserts that the given objects are equal using the first object’s .equal() method

Parameters

expected Object
Not documented.
actual Object
Not documented.
errorMessage String
is a string describing the failure

assertNotEqual

public static void assertNotEqual(byte expected, byte actual)
Asserts that the given bytes are not equal

assertNotEqual

public static void assertNotEqual(byte expected, byte actual, String errorMessage)
Asserts that the given bytes are not equal

Parameters

expected byte
Not documented.
actual byte
Not documented.
errorMessage String
is a string describing the failure

assertNotEqual

public static void assertNotEqual(short expected, short actual)
Asserts that the given shorts are not equal

assertNotEqual

public static void assertNotEqual(short expected, short actual, String errorMessage)
Asserts that the given shorts are not equal

Parameters

expected short
Not documented.
actual short
Not documented.
errorMessage String
is a string describing the failure

assertNotEqual

public static void assertNotEqual(int expected, int actual)
Asserts that the given ints are not equal

assertNotEqual

public static void assertNotEqual(int expected, int actual, String errorMessage)
Asserts that the given ints are not equal

Parameters

expected int
Not documented.
actual int
Not documented.
errorMessage String
is a string describing the failure

assertNotEqual

public static void assertNotEqual(long expected, long actual, double minRelativeError)
Asserts that the given longs are not equal

assertNotEqual

public static void assertNotEqual(long expected, long actual, double minRelativeError, String errorMessage)
Asserts that the given longs are not equal

Parameters

expected long
Not documented.
actual long
Not documented.
minRelativeError double
is the minimum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertNotEqual

public static void assertNotEqual(double expected, double actual, double minRelativeError)
Asserts that the given doubles are not equal

Parameters

expected double
Not documented.
actual double
Not documented.
minRelativeError double
is the minimum allowed error, a value of 1 represents a 1% error.

assertNotEqual

public static void assertNotEqual(double expected, double actual, double minRelativeError, String errorMessage)
Asserts that the given doubles are not equal

Parameters

expected double
Not documented.
actual double
Not documented.
minRelativeError double
is the minimum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertNotEqual

public static void assertNotEqual(Object expected, Object actual)
Asserts that the given objects are not equal using the first object’s .equal() method

assertNotEqual

public static void assertNotEqual(Object expected, Object actual, String errorMessage)
Asserts that the given objects are not equal using the first object’s .equal() method

Parameters

expected Object
Not documented.
actual Object
Not documented.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(byte[] expected, byte[] actual)
Asserts that the given byte arrays are equal

assertArrayEqual

public static void assertArrayEqual(byte[] expected, byte[] actual, String errorMessage)
Asserts that the given byte arrays are equal

Parameters

expected byte[]
Not documented.
actual byte[]
Not documented.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(short[] expected, short[] actual)
Asserts that the given short arrays are equal

assertArrayEqual

public static void assertArrayEqual(short[] expected, short[] actual, String errorMessage)
Asserts that the given short arrays are equal

Parameters

expected short[]
Not documented.
actual short[]
Not documented.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(int[] expected, int[] actual)
Asserts that the given int arrays are equal

assertArrayEqual

public static void assertArrayEqual(int[] expected, int[] actual, String errorMessage)
Asserts that the given int arrays are equal

Parameters

expected int[]
Not documented.
actual int[]
Not documented.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(long[] expected, long[] actual, double maxRelativeError)
Asserts that the given long arrays are equal

Parameters

expected long[]
Not documented.
actual long[]
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.

assertArrayEqual

public static void assertArrayEqual(long[] expected, long[] actual, double maxRelativeError, String errorMessage)
Asserts that the given long arrays are equal

Parameters

expected long[]
Not documented.
actual long[]
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError)
Asserts that the given float arrays are equal

Parameters

expected float[]
Not documented.
actual float[]
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.

assertArrayEqual

public static void assertArrayEqual(float[] expected, float[] actual, double maxRelativeError, String errorMessage)
Asserts that the given double arrays are equal

Parameters

expected float[]
Not documented.
actual float[]
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError)
Asserts that the given double arrays are equal

Parameters

expected double[]
Not documented.
actual double[]
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.

assertArrayEqual

public static void assertArrayEqual(double[] expected, double[] actual, double maxRelativeError, String errorMessage)
Asserts that the given double arrays are equal

Parameters

expected double[]
Not documented.
actual double[]
Not documented.
maxRelativeError double
is the maximum allowed error, a value of 1 represents a 1% error.
errorMessage String
is a string describing the failure

assertArrayEqual

public static void assertArrayEqual(Object[] expected, Object[] actual)
Asserts that the given object arrays are equal

assertArrayEqual

public static void assertArrayEqual(Object[] expected, Object[] actual, String errorMessage)
Asserts that the given object arrays are equal

Parameters

expected Object[]
Not documented.
actual Object[]
Not documented.
errorMessage String
is a string describing the failure

assertException

public static void assertException(RuntimeException exception, Runnable expression)
Asserts that a certain exception is raised

assertException

public static void assertException(RuntimeException exception, Runnable expression, String errorMessage)
Asserts that a certain exception is raised

assertNoException

public static void assertNoException(Runnable expression)
Asserts that no exception is raised

assertNoException

public static void assertNoException(Runnable expression, String errorMessage)
Asserts that no exception is raised

assertTitle

public static void assertTitle(String title)
Verifies the current title is the same otherwise throws an exception

Parameters

title String
the tile to verify

assertLabel

public static void assertLabel(String name, String text)
Asserts that we have a label with the given text baring the given name

Parameters

name String
the name of the label
text String
the text of the label

assertLabel

public static void assertLabel(int[] path, String text)
Asserts that we have a label with the given text baring the given name

Parameters

path int[]
the path of the label
text String
the text of the label

assertLabel

public static void assertLabel(String text)
Asserts that we have a label with the given text baring the given name

Parameters

text String
the text of the label

assertTextArea

public static void assertTextArea(String name, String text)
Asserts that we have a TextArea with the given text and the given name

Parameters

name String
the name of the TextArea
text String
the text of the TextArea

assertTextAreaContaining

public static void assertTextAreaContaining(String name, String text)
Asserts that we have a TextArea with the a text contains the given text and with the given name

Parameters

name String
the name of the TextArea
text String
the sequence to search for in the TextArea

assertTextAreaStartingWith

public static void assertTextAreaStartingWith(String name, String text)
Asserts that we have a TextArea with the a text starting with the given text and with the given name

Parameters

name String
the name of the TextArea
text String
the prefix to search for in the TextArea

assertTextAreaEndingWith

public static void assertTextAreaEndingWith(String name, String text)
Asserts that we have a TextArea with the a text ending with the given text and with the given name

Parameters

name String
the name of the TextArea
text String
the suffix to search for in the TextArea

assertTextArea

public static void assertTextArea(int[] path, String text)
Asserts that we have a label with the given text baring the given name

Parameters

path int[]
the path to the text area
text String
the text of the label

assertTextArea

public static void assertTextArea(String text)
Asserts that we have a label with the given text baring the given name

Parameters

text String
the text of the label

findTextAreaText

public static TextArea findTextAreaText(String text)
Finds a component with the given name, works even with UI’s that weren’t created with the GUI builder

Parameters

text String
the text of the label/button

Returns

the component with the given TextArea text within the tree