Skip to content

Commit

Permalink
(refactor) Explicitly state what keys/buttons mean in output
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMartinez committed Aug 23, 2017
1 parent 276cb4b commit 0d9c45a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,17 @@ public static UnaryOperator<AssertionError> informedErrorHandler(FxRobot robot)
Set<KeyCode> keysPressed = robot.robotContext().getKeyboardRobot().getPressedKeys();
Set<MouseButton> buttonsPressed = robot.robotContext().getMouseRobot().getPressedButtons();
StringBuilder sb = new StringBuilder(error.getMessage());
String spacedTab = " ";
// simulate tab character with 3 spaces
sb.append("\n\n").append("Context:")
.append("\n").append(spacedTab).append("Keys pressed: ").append(keysPressed)
.append("\n").append(spacedTab).append("Mouse Buttons pressed: ").append(buttonsPressed)
.append("\n").append(spacedTab).append("Fired events since test began:");
.append("\n ").append("Keys pressed at test failure: ")
.append("\n ").append(keysPressed)
.append("\n ").append("Mouse Buttons pressed at test failure: ")
.append("\n ").append(buttonsPressed)
.append("\n ").append("Fired events since test began:");

FxToolkit.toolkitContext().getFiredEvents().stream()
.map(Event::toString)
.forEach(e -> sb.append("\n").append(spacedTab).append(spacedTab).append(e));
.forEach(e -> sb.append("\n ").append(e));

return new AssertionError(sb.toString());
};
Expand Down

0 comments on commit 0d9c45a

Please sign in to comment.