Class DebugUtils


  • public final class DebugUtils
    extends java.lang.Object
    Utility class for displaying additional info, running code, or capturing an image of a test whenever a test fails using FxAssert.verifyThat(Node, Matcher) or its related methods.

    It is possible to create completely customized error messages by chaining functions together using compose(Function[]) or one can use the standard provided handlers such as informedErrorMessage(FxRobot), informedErrorMessage(FxRobot, String), etc. All indent parameters in methods are used to specify the spacing to insert in order to offset values. The default indent value is three spaces (e.g. " ").

    When a test fails, an image of the screen at the time of failure can be captured and saved to a PNG file. DebugUtils provides support for a number of image sizes: the full screen, a window, an area of the screen (i.e. bounds), or an individual node. Use the convenience methods prefixed by "save" (e.g. saveScreenshot(String)) to capture and save images. The image path will be printed using insertContent(String, Object) and will appear in the error message. For your own custom handler, use saveTestImage(Function, Supplier, String), one of the "capture"-prefixed methods, and a Supplier<Path> that determines where to save the image to.

    This class uses the concept of combining functions together in order to add additional information to the error message of an AssertionError thrown by a failing test.

    Example:

    
     // Template:
     compose(
          // insert a header for the section of error information
          insertHeader(headerText),
          // insert the specific content that falls under this header
          insertContent(contentHeading, content),
          insertContent(contentHeading2, contentIterable),
          insertContent(contentHeading3, contentArray),
          insertContent(contentHeading4, contentStream),
    
          // insert a header for the section of error information
          insertHeader(headerText),
          // insert the specific content that falls under this header
          insertContent(contentHeading5, contentStream2),
          insertContent(contentHeading6, contentStream3));
    
     // Example:
     compose(
          insertHeader("Context:"),
          showKeysPressedAtTestFailure(this),
          showMouseButtonsPressedAtTestFailure(this),
          showFiredEvents(),
          saveScreenshot());
    
     // is equivalent to:
    
     informedErrorMessage(this);
    
     // as it uses all of the default arguments.
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String DEFAULT_INDENT
      The default indentation to use for spacing between items of the error messages, defaults to three spaces.
      private static java.util.concurrent.atomic.AtomicInteger DEFAULT_PHOTO_NUMBER  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DebugUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureBounds​(javafx.geometry.Bounds bounds)  
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureBounds​(javafx.geometry.Rectangle2D bounds)  
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureNode​(javafx.scene.Node node)  
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureScreenshot()  
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureScreenshot​(int screenIndex)  
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureScreenshot​(javafx.stage.Screen screen)  
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureWindow()
      Captures the registered stage.
      static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureWindow​(javafx.stage.Window window)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> compose​(java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder>... functions)
      Composes multiple functions together into one.
      static java.util.function.Supplier<java.nio.file.Path> defaultImagePath()
      Returns defaultImagePath(String, int) with "testfx-test" as the test name and gets and increments the next photo number.
      static java.util.function.Supplier<java.nio.file.Path> defaultImagePath​(java.lang.String testName)
      Returns () -> Paths.get(testName + " - 0.png");
      static java.util.function.Supplier<java.nio.file.Path> defaultImagePath​(java.lang.String testName, int photoNumber)
      Returns () -> Paths.get(testName + " - " photoNumber + ".png");
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> informedErrorMessage​(java.lang.String headerText, boolean takeScreenshot, boolean showFiredEvents, FxRobot robot, boolean showKeysPressed, boolean showMouseButtonsPressed)
      Convenience method for insertHeader(String) using "Context:" as the header text and then, via insertContent(String, Object), composes showKeysPressedAtTestFailure(FxRobot), showMouseButtonsPressedAtTestFailure(FxRobot), and showFiredEvents() together in their given order, depending on what the booleans are.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> informedErrorMessage​(FxRobot robot)
      Convenience method for informedErrorMessage(String, boolean, boolean, FxRobot, boolean, boolean) with all booleans set to true and the header text set to "Context:".
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> informedErrorMessage​(FxRobot robot, java.lang.String headerText)
      Convenience method for informedErrorMessage(String, boolean, boolean, FxRobot, boolean, boolean) with all booleans set to true.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.lang.Iterable<?> contentIter)
      Inserts the heading on a newline followed by two default indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.lang.Iterable<?> contentIter, java.lang.String indent)
      Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.lang.Object content)
      Inserts the heading on a newline followed by two default indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.lang.Object[] contentArray)
      Inserts the heading on a newline followed by two default indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.lang.Object[] contentArray, java.lang.String indent)
      Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.lang.Object content, java.lang.String indent)
      Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.util.stream.Stream<?> contentStream)
      Inserts the heading on a newline followed by two default indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading, java.util.stream.Stream<?> contentStream, java.lang.String indent)
      Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertHeader​(java.lang.String headerText)
      Inserts a header on a newline followed by the default indent; useful for specifying a section in the error message.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertHeader​(java.lang.String headerText, java.lang.String indent)
      Inserts a header on a newline followed by the given indent; useful for specifying a section in the error message.
      private static javafx.geometry.Rectangle2D mapToRect2D​(javafx.geometry.Bounds bounds)  
      private static javafx.geometry.Rectangle2D mapToRect2D​(javafx.stage.Window window)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> runCode​(java.lang.Runnable runnable)
      Ignores the given StringBuilder and just runs the given code block.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Bounds bounds)
      Saves the captured image based on the given bounds using defaultImagePath() and the DEFAULT_INDENT.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Bounds bounds, java.lang.String testName, int photoNumber)
      Saves the captured image based on the given bounds to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Bounds bounds, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured image based on the given bounds to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Rectangle2D bounds)
      Saves the captured image based on the given bounds using defaultImagePath() and the DEFAULT_INDENT.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Rectangle2D bounds, java.lang.String testName, int photoNumber)
      Saves the captured image based on the given bounds to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Rectangle2D bounds, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured image based on the given bounds to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveNode​(javafx.scene.Node node)
      Saves the captured node using defaultImagePath() and the DEFAULT_INDENT.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveNode​(javafx.scene.Node node, java.lang.String testName, int photoNumber)
      Saves the captured node image to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveNode​(javafx.scene.Node node, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured node to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot()
      Saves the captured primary screen image using defaultImagePath() and the DEFAULT_INDENT.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(int screenIndex, java.lang.String testName, int photoNumber)
      Saves the captured screenshot of the screen at the given index in Screen.getScreens()} to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(int screenIndex, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured screenshot of the screen at the given index in Screen.getScreens()} to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(java.lang.String testName)
      Saves the captured screenshot of the primary screen to "testName - 0.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(java.lang.String testName, int photoNumber)
      Saves the captured screenshot of the primary screen to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured screenshot of the primary screen to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(javafx.stage.Screen screen, java.lang.String testName, int photoNumber)
      Saves the captured screenshot of the screen to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(javafx.stage.Screen screen, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured screenshot of the screen to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveTestImage​(java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureImage, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured image to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow()
      Saves the captured registered stage image using defaultImagePath() and the DEFAULT_INDENT.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(java.lang.String testName, int photoNumber)
      Saves the captured registered stage "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured registered stage to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(javafx.stage.Window window, java.lang.String testName, int photoNumber)
      Saves the captured window to "testName - photoNumber.png" (e.g.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(javafx.stage.Window window, java.util.function.Supplier<java.nio.file.Path> capturedImagePath, java.lang.String indent)
      Saves the captured window to the supplied path.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents()
      Via insertContent(String, Object): shows all events that were fired since the start of the test.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(java.lang.String indent)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(java.util.List<javafx.event.Event> events)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(java.util.List<javafx.event.Event> events, java.lang.String indent)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(FiredEvents events)
      Via insertContent(String, Object): shows all events that were fired since the start of the test.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(FiredEvents events, java.lang.String indent)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showKeysPressedAtTestFailure​(FxRobot robot)
      Via insertContent(String, Object): shows the keys that were pressed when the test failed.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showKeysPressedAtTestFailure​(FxRobot robot, java.lang.String indent)  
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showMouseButtonsPressedAtTestFailure​(FxRobot robot)
      Via insertContent(String, Object): shows the MouseButtons that were pressed when the test failed.
      static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showMouseButtonsPressedAtTestFailure​(FxRobot robot, java.lang.String indent)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_INDENT

        private static final java.lang.String DEFAULT_INDENT
        The default indentation to use for spacing between items of the error messages, defaults to three spaces.
        See Also:
        Constant Field Values
      • DEFAULT_PHOTO_NUMBER

        private static final java.util.concurrent.atomic.AtomicInteger DEFAULT_PHOTO_NUMBER
    • Constructor Detail

      • DebugUtils

        private DebugUtils()
    • Method Detail

      • compose

        @SafeVarargs
        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> compose​(java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder>... functions)
        Composes multiple functions together into one. The functions are called in the order that they appear in the array. That is, functions[0] is run first, functions[1] is run second, etc.
      • runCode

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> runCode​(java.lang.Runnable runnable)
        Ignores the given StringBuilder and just runs the given code block.
      • insertHeader

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertHeader​(java.lang.String headerText)
        Inserts a header on a newline followed by the default indent; useful for specifying a section in the error message.
      • insertHeader

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertHeader​(java.lang.String headerText,
                                                                                                                      java.lang.String indent)
        Inserts a header on a newline followed by the given indent; useful for specifying a section in the error message.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.lang.Object content)
        Inserts the heading on a newline followed by two default indents followed by the given contentHeading. Then, inserts a newline followed by three default indents followed by the content itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.lang.Object content,
                                                                                                                       java.lang.String indent)
        Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading. Then, inserts a newline followed by three of the given indents followed by the content itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.lang.Iterable<?> contentIter)
        Inserts the heading on a newline followed by two default indents followed by the given contentHeading. Then, for each item in the given iterable, inserts a newline followed by three default indents followed by the list item itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.lang.Iterable<?> contentIter,
                                                                                                                       java.lang.String indent)
        Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading. Then, for each item in the given iterable, inserts a newline followed by three of the given indents followed by the list item itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.lang.Object[] contentArray)
        Inserts the heading on a newline followed by two default indents followed by the given contentHeading. Then, for each item in the given array, inserts a newline followed by three default indents followed by the array item itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.lang.Object[] contentArray,
                                                                                                                       java.lang.String indent)
        Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading. Then, for each item in the given array, inserts a newline followed by three of the given indents followed by the array item itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.util.stream.Stream<?> contentStream)
        Inserts the heading on a newline followed by two default indents followed by the given contentHeading. Then, for each item in the given stream, inserts a newline followed by three default indents followed by the item itself.
      • insertContent

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> insertContent​(java.lang.String contentHeading,
                                                                                                                       java.util.stream.Stream<?> contentStream,
                                                                                                                       java.lang.String indent)
        Inserts the heading on a newline followed by two of the given indents followed by the given contentHeading. Then, for each item in the given stream, inserts a newline followed by three of the given indents followed by the item itself.
      • showKeysPressedAtTestFailure

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showKeysPressedAtTestFailure​(FxRobot robot)
        Via insertContent(String, Object): shows the keys that were pressed when the test failed.
      • showKeysPressedAtTestFailure

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showKeysPressedAtTestFailure​(FxRobot robot,
                                                                                                                                      java.lang.String indent)
      • showMouseButtonsPressedAtTestFailure

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showMouseButtonsPressedAtTestFailure​(FxRobot robot)
        Via insertContent(String, Object): shows the MouseButtons that were pressed when the test failed.
      • showMouseButtonsPressedAtTestFailure

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showMouseButtonsPressedAtTestFailure​(FxRobot robot,
                                                                                                                                              java.lang.String indent)
      • showFiredEvents

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(java.lang.String indent)
      • showFiredEvents

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(FiredEvents events)
        Via insertContent(String, Object): shows all events that were fired since the start of the test.
      • showFiredEvents

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(FiredEvents events,
                                                                                                                         java.lang.String indent)
      • showFiredEvents

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(java.util.List<javafx.event.Event> events)
      • showFiredEvents

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> showFiredEvents​(java.util.List<javafx.event.Event> events,
                                                                                                                         java.lang.String indent)
      • captureScreenshot

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureScreenshot()
      • captureScreenshot

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureScreenshot​(int screenIndex)
      • captureScreenshot

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureScreenshot​(javafx.stage.Screen screen)
      • captureWindow

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureWindow()
        Captures the registered stage.
      • captureWindow

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureWindow​(javafx.stage.Window window)
      • captureBounds

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureBounds​(javafx.geometry.Bounds bounds)
      • captureBounds

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureBounds​(javafx.geometry.Rectangle2D bounds)
      • captureNode

        public static java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureNode​(javafx.scene.Node node)
      • defaultImagePath

        public static java.util.function.Supplier<java.nio.file.Path> defaultImagePath()
        Returns defaultImagePath(String, int) with "testfx-test" as the test name and gets and increments the next photo number.
      • defaultImagePath

        public static java.util.function.Supplier<java.nio.file.Path> defaultImagePath​(java.lang.String testName)
        Returns () -> Paths.get(testName + " - 0.png");
      • defaultImagePath

        public static java.util.function.Supplier<java.nio.file.Path> defaultImagePath​(java.lang.String testName,
                                                                                       int photoNumber)
        Returns () -> Paths.get(testName + " - " photoNumber + ".png");
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot()
        Saves the captured primary screen image using defaultImagePath() and the DEFAULT_INDENT.
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(java.lang.String testName)
        Saves the captured screenshot of the primary screen to "testName - 0.png" (e.g. "button_has_label - 0.png").
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(java.lang.String testName,
                                                                                                                        int photoNumber)
        Saves the captured screenshot of the primary screen to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                        java.lang.String indent)
        Saves the captured screenshot of the primary screen to the supplied path.
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(javafx.stage.Screen screen,
                                                                                                                        java.lang.String testName,
                                                                                                                        int photoNumber)
        Saves the captured screenshot of the screen to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(javafx.stage.Screen screen,
                                                                                                                        java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                        java.lang.String indent)
        Saves the captured screenshot of the screen to the supplied path.
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(int screenIndex,
                                                                                                                        java.lang.String testName,
                                                                                                                        int photoNumber)
        Saves the captured screenshot of the screen at the given index in Screen.getScreens()} to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveScreenshot

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveScreenshot​(int screenIndex,
                                                                                                                        java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                        java.lang.String indent)
        Saves the captured screenshot of the screen at the given index in Screen.getScreens()} to the supplied path.
      • saveWindow

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow()
        Saves the captured registered stage image using defaultImagePath() and the DEFAULT_INDENT.
      • saveWindow

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(java.lang.String testName,
                                                                                                                    int photoNumber)
        Saves the captured registered stage "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveWindow

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                    java.lang.String indent)
        Saves the captured registered stage to the supplied path.
      • saveWindow

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(javafx.stage.Window window,
                                                                                                                    java.lang.String testName,
                                                                                                                    int photoNumber)
        Saves the captured window to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveWindow

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveWindow​(javafx.stage.Window window,
                                                                                                                    java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                    java.lang.String indent)
        Saves the captured window to the supplied path.
      • saveBounds

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Bounds bounds)
        Saves the captured image based on the given bounds using defaultImagePath() and the DEFAULT_INDENT.
      • saveBounds

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Bounds bounds,
                                                                                                                    java.lang.String testName,
                                                                                                                    int photoNumber)
        Saves the captured image based on the given bounds to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveBounds

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Bounds bounds,
                                                                                                                    java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                    java.lang.String indent)
        Saves the captured image based on the given bounds to the supplied path.
      • saveBounds

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Rectangle2D bounds)
        Saves the captured image based on the given bounds using defaultImagePath() and the DEFAULT_INDENT.
      • saveBounds

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Rectangle2D bounds,
                                                                                                                    java.lang.String testName,
                                                                                                                    int photoNumber)
        Saves the captured image based on the given bounds to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveBounds

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveBounds​(javafx.geometry.Rectangle2D bounds,
                                                                                                                    java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                    java.lang.String indent)
        Saves the captured image based on the given bounds to the supplied path.
      • saveNode

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveNode​(javafx.scene.Node node)
        Saves the captured node using defaultImagePath() and the DEFAULT_INDENT.
      • saveNode

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveNode​(javafx.scene.Node node,
                                                                                                                  java.lang.String testName,
                                                                                                                  int photoNumber)
        Saves the captured node image to "testName - photoNumber.png" (e.g. "button_has_label - 2.png").
      • saveNode

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveNode​(javafx.scene.Node node,
                                                                                                                  java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                  java.lang.String indent)
        Saves the captured node to the supplied path.
      • saveTestImage

        public static java.util.function.Function<java.lang.StringBuilder,​java.lang.StringBuilder> saveTestImage​(java.util.function.Function<CaptureSupport,​javafx.scene.image.Image> captureImage,
                                                                                                                       java.util.function.Supplier<java.nio.file.Path> capturedImagePath,
                                                                                                                       java.lang.String indent)
        Saves the captured image to the supplied path.
      • mapToRect2D

        private static javafx.geometry.Rectangle2D mapToRect2D​(javafx.geometry.Bounds bounds)
      • mapToRect2D

        private static javafx.geometry.Rectangle2D mapToRect2D​(javafx.stage.Window window)