Class TestUtils

java.lang.Object
com.codename1.testing.TestUtils

public final class TestUtils extends Object
Various utility classes to automate UI testing
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    assertArrayEqual(byte[] expected, byte[] actual)
    Asserts that the given byte arrays are equal
    static void
    assertArrayEqual(byte[] expected, byte[] actual, String errorMessage)
    Asserts that the given byte arrays are equal
    static void
    assertArrayEqual(double[] expected, double[] actual, double maxRelativeError)
    Asserts that the given double arrays are equal
    static void
    assertArrayEqual(double[] expected, double[] actual, double maxRelativeError, String errorMessage)
    Asserts that the given double arrays are equal
    static void
    assertArrayEqual(float[] expected, float[] actual, double maxRelativeError)
    Asserts that the given float arrays are equal
    static void
    assertArrayEqual(float[] expected, float[] actual, double maxRelativeError, String errorMessage)
    Asserts that the given double arrays are equal
    static void
    assertArrayEqual(int[] expected, int[] actual)
    Asserts that the given int arrays are equal
    static void
    assertArrayEqual(int[] expected, int[] actual, String errorMessage)
    Asserts that the given int arrays are equal
    static void
    assertArrayEqual(long[] expected, long[] actual, double maxRelativeError)
    Asserts that the given long arrays are equal
    static void
    assertArrayEqual(long[] expected, long[] actual, double maxRelativeError, String errorMessage)
    Asserts that the given long arrays are equal
    static void
    assertArrayEqual(short[] expected, short[] actual)
    Asserts that the given short arrays are equal
    static void
    assertArrayEqual(short[] expected, short[] actual, String errorMessage)
    Asserts that the given short arrays are equal
    static void
    assertArrayEqual(Object[] expected, Object[] actual)
    Asserts that the given object arrays are equal
    static void
    assertArrayEqual(Object[] expected, Object[] actual, String errorMessage)
    Asserts that the given object arrays are equal
    static void
    assertBool(boolean b)
    Assertions allow for simpler test code
    static void
    assertBool(boolean b, String errorMessage)
    Assertions allow for simpler test code
    static void
    assertEqual(byte expected, byte actual)
    Asserts that the given bytes are equal
    static void
    assertEqual(byte expected, byte actual, String errorMessage)
    Asserts that the given bytes are equal
    static void
    assertEqual(double expected, double actual, double maxRelativeError)
    Asserts that the given doubles are equal
    static void
    assertEqual(double expected, double actual, double maxRelativeError, String errorMessage)
    Asserts that the given doubles are equal
    static void
    assertEqual(float expected, float actual, double maxRelativeError)
    Asserts that the given floats are equal
    static void
    assertEqual(float expected, float actual, double maxRelativeError, String errorMessage)
    Asserts that the given floats are equal
    static void
    assertEqual(int expected, int actual)
    Asserts that the given ints are equal
    static void
    assertEqual(int expected, int actual, String errorMessage)
    Asserts that the given ints are equal
    static void
    assertEqual(long expected, long actual)
    Asserts that the given longs are equal
    static void
    assertEqual(long expected, long actual, String errorMessage)
    Asserts that the given longs are equal
    static void
    assertEqual(short expected, short actual)
    Asserts that the given shorts are equal
    static void
    assertEqual(short expected, short actual, String errorMessage)
    Asserts that the given shorts are equal
    static void
    assertEqual(Object expected, Object actual)
    Asserts that the given objects are equal using the first object's .equal() method
    static void
    assertEqual(Object expected, Object actual, String errorMessage)
    Asserts that the given objects are equal using the first object's .equal() method
    static void
    assertException(RuntimeException exception, Runnable expression)
    Asserts that a certain exception is raised
    static void
    assertException(RuntimeException exception, Runnable expression, String errorMessage)
    Asserts that a certain exception is raised
    static void
    assertFalse(boolean value)
    Asserts that the given expression evaluates to false
    static void
    assertFalse(boolean value, String errorMessage)
    Asserts that the given expression evaluates to false
    static void
    assertLabel(int[] path, String text)
    Asserts that we have a label with the given text baring the given name
    static void
    Asserts that we have a label with the given text baring the given name
    static void
    assertLabel(String name, String text)
    Asserts that we have a label with the given text baring the given name
    static void
    Asserts that no exception is raised
    static void
    assertNoException(Runnable expression, String errorMessage)
    Asserts that no exception is raised
    static void
    assertNotEqual(byte expected, byte actual)
    Asserts that the given bytes are not equal
    static void
    assertNotEqual(byte expected, byte actual, String errorMessage)
    Asserts that the given bytes are not equal
    static void
    assertNotEqual(double expected, double actual, double minRelativeError)
    Asserts that the given doubles are not equal
    static void
    assertNotEqual(double expected, double actual, double minRelativeError, String errorMessage)
    Asserts that the given doubles are not equal
    static void
    assertNotEqual(int expected, int actual)
    Asserts that the given ints are not equal
    static void
    assertNotEqual(int expected, int actual, String errorMessage)
    Asserts that the given ints are not equal
    static void
    assertNotEqual(long expected, long actual, double minRelativeError)
    Asserts that the given longs are not equal
    static void
    assertNotEqual(long expected, long actual, double minRelativeError, String errorMessage)
    Asserts that the given longs are not equal
    static void
    assertNotEqual(short expected, short actual)
    Asserts that the given shorts are not equal
    static void
    assertNotEqual(short expected, short actual, String errorMessage)
    Asserts that the given shorts are not equal
    static void
    assertNotEqual(Object expected, Object actual)
    Asserts that the given objects are not equal using the first object's .equal() method
    static void
    assertNotEqual(Object expected, Object actual, String errorMessage)
    Asserts that the given objects are not equal using the first object's .equal() method
    static void
    Asserts that the given expression does not evaluate to null
    static void
    assertNotNull(Object object, String errorMessage)
    Asserts that the given expression does not evaluate to null
    static void
    assertNotSame(Object expected, Object actual)
    Asserts that the given parameters do not reference the same object
    static void
    assertNotSame(Object expected, Object actual, String errorMessage)
    Asserts that the given parameters do not reference the same object
    static void
    Asserts that the given expression evaluates to null
    static void
    assertNull(Object object, String errorMessage)
    Asserts that the given expression evaluates to null
    static void
    assertRange(double expected, double actual, double absoluteError)
    Asserts that the given doubles are equal
    static void
    assertRange(double expected, double actual, double maxAbsoluteError, String errorMessage)
    Asserts that the given doubles are equal
    static void
    assertSame(Object expected, Object actual)
    Asserts that the given parameters reference the same object
    static void
    assertSame(Object expected, Object actual, String errorMessage)
    Asserts that the given parameters reference the same object
    static void
    assertTextArea(int[] path, String text)
    Asserts that we have a label with the given text baring the given name
    static void
    Asserts that we have a label with the given text baring the given name
    static void
    Asserts that we have a TextArea with the given text and the given name
    static void
    Asserts that we have a TextArea with the a text contains the given text and with the given name
    static void
    Asserts that we have a TextArea with the a text ending with the given text and with the given name
    static void
    Asserts that we have a TextArea with the a text starting with the given text and with the given name
    static void
    Verifies the current title is the same otherwise throws an exception
    static void
    assertTrue(boolean value)
    Asserts that the given expression evaluates to true
    static void
    assertTrue(boolean value, String errorMessage)
    Asserts that the given expression evaluates to true
    static void
    Clicks the button with the given label
    static void
    Clicks the button with the given label
    static void
    clickButtonByPath(int[] path)
    Clicks the button with the given component path
    static void
    Executes a menu command with the given name
    static void
    ensureVisible(int[] path)
    Scrolls to show the component in case it is invisible currently
    static void
    Scrolls to show the component in case it is invisible currently
    static void
    ensureVisible(String componentName)
    Scrolls to show the component in case it is invisible currently
    static void
    Executes a command from the offset returned by #getToolbarCommands()
    static void
    An assertion that always fails a test.
    static void
    fail(String errorMessage)
    An assertion that always fails a test.
    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
    static Label
    Finds a component with the given name, works even with UI's that weren't created with the GUI builder
    static TextArea
    Finds a component with the given name, works even with UI's that weren't created with the GUI builder
    static void
    gameKeyPress(int gameKey)
    Simulates a game key press
    static void
    gameKeyRelease(int gameKey)
    Simulates a game key release
    static Component
    getComponentByPath(int[] path)
    Gets the component from the current form based on its path.
    static Command[]
    Returns all the command objects from the toolbar in the order of left, right, overflow & sidemenu
    static void
    Executes the back command for the current form, similarly to pressing the back button
    static void
    keyPress(int keyCode)
    Simulates a device key press
    static void
    keyRelease(int keyCode)
    Simulates a device key release
    static void
    Log to the test log
    static void
    Log to the test log
    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.
    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.
    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.
    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.
    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.
    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.
    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.
    static void
    selectInList(int[] path, int offset)
    Selects the given offset in a list
    static void
    selectInList(String listName, int offset)
    Selects the given offset in a list
    static void
    setText(int[] path, String text)
    Sets the text for the given component
    static void
    setText(String name, String text)
    Sets the text for the given component
    static void
    setVerboseMode(boolean v)
    Activates/deactivates the verbose test mode
    static void
    Shows the sidemenu UI
    static void
    waitFor(int millis)
    Waits for the given number of milliseconds even if the waiting is on the EDT thread
    static void
    Waits for a form change and if no form change occurred after a given timeout then fail the test.
    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
    static void
    Waits for a form change and if no form change occurred after a given timeout then fail the test.
    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
    static void
    Waits for a form change and if no form change occurred after a given timeout then fail the test
    static void
    waitForUnnamedForm(long timeout)
    Waits for a form change and if no form change occurred after a given timeout then fail the test

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setVerboseMode

      public static void setVerboseMode(boolean v)

      Activates/deactivates the verbose test mode

      Parameters
      • v: 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: 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: 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: the name of the list component

      • offset: the offset to select

    • selectInList

      public static void selectInList(int[] path, int offset)

      Selects the given offset in a list

      Parameters
      • offset: 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: 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: the text on the button
    • clickButtonByName

      public static void clickButtonByName(String name)

      Clicks the button with the given label

      Parameters
      • name: the name of the button
    • clickButtonByPath

      public static void clickButtonByPath(int[] path)

      Clicks the button with the given component path

      Parameters
      • path: 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: 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: 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: the component
    • ensureVisible

      public static void ensureVisible(String componentName)

      Scrolls to show the component in case it is invisible currently

      Parameters
      • componentName: the component
    • ensureVisible

      public static void ensureVisible(int[] path)

      Scrolls to show the component in case it is invisible currently

      Parameters
      • path: 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: the title of the form to wait for

      • timeout: 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: 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: the name of the form to wait for

      • timeout: 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: 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: 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: the name to use for the storage, must be unique!
      Returns
      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: the string to log
    • log

      public static void log(Throwable t)

      Log to the test log

      Parameters
      • t: exception to log
    • keyPress

      public static void keyPress(int keyCode)

      Simulates a device key press

      Parameters
      • keyCode: the keycode
    • keyRelease

      public static void keyRelease(int keyCode)

      Simulates a device key release

      Parameters
      • keyCode: the keycode
    • gameKeyPress

      public static void gameKeyPress(int gameKey)

      Simulates a game key press

      Parameters
      • gameKey: the game key (arrows etc.)
    • gameKeyRelease

      public static void gameKeyRelease(int gameKey)

      Simulates a game key release

      Parameters
      • gameKey: 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: the offset within the component as a number between 0 and 1

      • y: the offset within the component as a number between 0 and 1

      • componentName: 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: the offset within the component as a number between 0 and 1

      • y: the offset within the component as a number between 0 and 1

      • componentName: 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: the offset within the component as a number between 0 and 1

      • y: the offset within the component as a number between 0 and 1

      • componentName: 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: the offset within the component as a number between 0 and 1

      • y: the offset within the component as a number between 0 and 1

      • path: 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: the offset within the component as a number between 0 and 1

      • y: the offset within the component as a number between 0 and 1

      • path: 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: the offset within the component as a number between 0 and 1

      • y: the offset within the component as a number between 0 and 1

      • path: 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: an array
      Returns

      a component

    • setText

      public static void setText(String name, String text)

      Sets the text for the given component

      Parameters
      • name: the name of the component

      • text: the text to set

    • setText

      public static void setText(int[] path, String text)

      Sets the text for the given component

      Parameters
      • path: the path to the component

      • text: the text to set

    • assertBool

      public static void assertBool(boolean b)

      Assertions allow for simpler test code

      Parameters
      • b: 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: must be true, otherwise an exception is thrown thus failing the test
    • 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: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • maxRelativeError: 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
      • maxRelativeError: is the maximum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • maxRelativeError: 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: Expected value

      • actual: Actual value

      • absoluteError: is the maximum allowed error, a value of 1 represents a 1% error.

      Since

      8.0

    • assertEqual

      public static void assertEqual(double expected, double actual, double maxRelativeError, String errorMessage)

      Asserts that the given doubles are equal

      Parameters
      • maxRelativeError: is the maximum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • maxRelativeError: is the maximum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • minRelativeError: is the minimum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • minRelativeError: 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
      • minRelativeError: is the minimum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • errorMessage: 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
      • maxRelativeError: 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
      • maxRelativeError: is the maximum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • maxRelativeError: 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
      • maxRelativeError: is the maximum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • maxRelativeError: 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
      • maxRelativeError: is the maximum allowed error, a value of 1 represents a 1% error.

      • errorMessage: 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
      • errorMessage: is a string describing the failure
    • assertException

      public static void assertException(RuntimeException exception, Runnable expression)

      Asserts that a certain exception is raised

      Parameters
      • exception

      • expression

    • assertException

      public static void assertException(RuntimeException exception, Runnable expression, String errorMessage)

      Asserts that a certain exception is raised

      Parameters
      • exception

      • expression

      • errorMessage

    • assertNoException

      public static void assertNoException(Runnable expression)

      Asserts that no exception is raised

      Parameters
      • expression
    • assertNoException

      public static void assertNoException(Runnable expression, String errorMessage)

      Asserts that no exception is raised

      Parameters
      • expression

      • errorMessage

    • assertTitle

      public static void assertTitle(String title)

      Verifies the current title is the same otherwise throws an exception

      Parameters
      • title: 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: the name of the label

      • text: 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: the path of the label

      • text: 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: 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: the name of the TextArea

      • text: 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: the name of the TextArea

      • text: 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: the name of the TextArea

      • text: 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: the name of the TextArea

      • text: 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: the path to the text area

      • text: 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: 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: the text of the label/button
      Returns

      the component with the given TextArea text within the tree