Skip to content

Commit

Permalink
JUnit Assume: Migrate to JUnit 5 Assume API
Browse files Browse the repository at this point in the history
HelpWindowTest uses JUnit 4's Assume API to skip the test
in headless mode, due to a bug in JavaFX.
This bug is still yet to be fixed, hence we need to continue skipping
the test using JUnit's assumeFalse.

In JUnit 5, the API has migrated to org.junit.jupiter.api.Assume.*,
while the old APIs are left to maintain backward compatibility. While
the functionality remains largely similar, it is necessary to
standardize using JUnit 5 APIs as we migrate our tests to JUnit 5
style.

Let's migrate our calls to JUnit's Assume API to use the ones
provided by JUnit 5 instead.

In this migration, the API for Assume#assumeFalse(String, boolean) is
now changed to assumeFalse(boolean, String). The relevant method calls
have been updated to reflect this signature change.
  • Loading branch information
sijie123 committed Apr 13, 2019
1 parent a6362f3 commit 8ba95a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/java/seedu/address/ui/HelpWindowTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package seedu.address.ui;

import static org.junit.Assume.assumeFalse;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static seedu.address.ui.HelpWindow.USERGUIDE_FILE_PATH;

import java.net.URL;
Expand Down Expand Up @@ -56,7 +56,7 @@ public void focus_helpWindowNotFocused_focused() throws Exception {
// stage2.isFocused() returns true. However, as reported in the bug report,
// both stage1.isFocused() and stage2.isFocused() returns true,
// which fails the test.
assumeFalse("Test skipped in headless mode: Window focus behavior is buggy.", guiRobot.isHeadlessMode());
assumeFalse(guiRobot.isHeadlessMode(), "Test skipped in headless mode: Window focus behavior is buggy.");
guiRobot.interact(helpWindow::show);

// Focus on another stage to remove focus from the helpWindow
Expand Down

0 comments on commit 8ba95a8

Please sign in to comment.