Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
AddressBookSystemTest: Verify that ResultDisplay style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yamgent committed Jan 19, 2018
1 parent e1accaf commit 0357510
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/test/java/systemtests/AddCommandSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private void assertCommandSuccess(String command, Model expectedModel, String ex
executeCommand(command);
assertApplicationDisplaysExpected("", expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsDefaultStyle();
assertCommandBoxAndResultDisplayShowsDefaultStyle();
assertStatusBarUnchangedExceptSyncStatus();
}

Expand All @@ -255,7 +255,7 @@ private void assertCommandFailure(String command, String expectedResultMessage)
executeCommand(command);
assertApplicationDisplaysExpected(command, expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsErrorStyle();
assertCommandBoxAndResultDisplayShowsErrorStyle();
assertStatusBarUnchanged();
}
}
16 changes: 12 additions & 4 deletions src/test/java/systemtests/AddressBookSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import seedu.address.model.Model;
import seedu.address.testutil.TypicalPersons;
import seedu.address.ui.CommandBox;
import seedu.address.ui.ResultDisplay;

/**
* A system test class for AddressBook, which provides access to handles of GUI components and helper methods
Expand All @@ -54,6 +55,11 @@ public abstract class AddressBookSystemTest {
private static final List<String> COMMAND_BOX_ERROR_STYLE =
Arrays.asList("text-input", "text-field", CommandBox.ERROR_STYLE_CLASS);

private static final List<String> RESULT_DISPLAY_DEFAULT_STYLE =
Arrays.asList("text-input", "text-area", "result-display");
private static final List<String> RESULT_DISPLAY_ERROR_STYLE =
Arrays.asList("text-input", "text-area", "result-display", ResultDisplay.ERROR_STYLE_CLASS);

private MainWindowHandle mainWindowHandle;
private TestApp testApp;
private SystemTestSetupHelper setupHelper;
Expand Down Expand Up @@ -235,17 +241,19 @@ protected void assertSelectedCardUnchanged() {
}

/**
* Asserts that the command box's shows the default style.
* Asserts that the command box and result display shows the default style.
*/
protected void assertCommandBoxShowsDefaultStyle() {
protected void assertCommandBoxAndResultDisplayShowsDefaultStyle() {
assertEquals(COMMAND_BOX_DEFAULT_STYLE, getCommandBox().getStyleClass());
assertEquals(RESULT_DISPLAY_DEFAULT_STYLE, getResultDisplay().getStyleClass());
}

/**
* Asserts that the command box's shows the error style.
* Asserts that the command box and result display shows the error style.
*/
protected void assertCommandBoxShowsErrorStyle() {
protected void assertCommandBoxAndResultDisplayShowsErrorStyle() {
assertEquals(COMMAND_BOX_ERROR_STYLE, getCommandBox().getStyleClass());
assertEquals(RESULT_DISPLAY_ERROR_STYLE, getResultDisplay().getStyleClass());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/systemtests/ClearCommandSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void assertCommandSuccess(String command) {
private void assertCommandSuccess(String command, String expectedResultMessage, Model expectedModel) {
executeCommand(command);
assertApplicationDisplaysExpected("", expectedResultMessage, expectedModel);
assertCommandBoxShowsDefaultStyle();
assertCommandBoxAndResultDisplayShowsDefaultStyle();
assertStatusBarUnchangedExceptSyncStatus();
}

Expand All @@ -95,7 +95,7 @@ private void assertCommandFailure(String command, String expectedResultMessage)
executeCommand(command);
assertApplicationDisplaysExpected(command, expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsErrorStyle();
assertCommandBoxAndResultDisplayShowsErrorStyle();
assertStatusBarUnchanged();
}
}
4 changes: 2 additions & 2 deletions src/test/java/systemtests/DeleteCommandSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void assertCommandSuccess(String command, Model expectedModel, String ex
assertSelectedCardUnchanged();
}

assertCommandBoxShowsDefaultStyle();
assertCommandBoxAndResultDisplayShowsDefaultStyle();
assertStatusBarUnchangedExceptSyncStatus();
}

Expand All @@ -194,7 +194,7 @@ private void assertCommandFailure(String command, String expectedResultMessage)
executeCommand(command);
assertApplicationDisplaysExpected(command, expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsErrorStyle();
assertCommandBoxAndResultDisplayShowsErrorStyle();
assertStatusBarUnchanged();
}
}
4 changes: 2 additions & 2 deletions src/test/java/systemtests/EditCommandSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private void assertCommandSuccess(String command, Model expectedModel, String ex
executeCommand(command);
expectedModel.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
assertApplicationDisplaysExpected("", expectedResultMessage, expectedModel);
assertCommandBoxShowsDefaultStyle();
assertCommandBoxAndResultDisplayShowsDefaultStyle();
if (expectedSelectedCardIndex != null) {
assertSelectedCardChanged(expectedSelectedCardIndex);
} else {
Expand All @@ -276,7 +276,7 @@ private void assertCommandFailure(String command, String expectedResultMessage)
executeCommand(command);
assertApplicationDisplaysExpected(command, expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsErrorStyle();
assertCommandBoxAndResultDisplayShowsErrorStyle();
assertStatusBarUnchanged();
}
}
4 changes: 2 additions & 2 deletions src/test/java/systemtests/FindCommandSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private void assertCommandSuccess(String command, Model expectedModel) {

executeCommand(command);
assertApplicationDisplaysExpected("", expectedResultMessage, expectedModel);
assertCommandBoxShowsDefaultStyle();
assertCommandBoxAndResultDisplayShowsDefaultStyle();
assertStatusBarUnchanged();
}

Expand All @@ -188,7 +188,7 @@ private void assertCommandFailure(String command, String expectedResultMessage)
executeCommand(command);
assertApplicationDisplaysExpected(command, expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsErrorStyle();
assertCommandBoxAndResultDisplayShowsErrorStyle();
assertStatusBarUnchanged();
}
}
4 changes: 2 additions & 2 deletions src/test/java/systemtests/SelectCommandSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void assertCommandSuccess(String command, Index expectedSelectedCardInde
assertSelectedCardChanged(expectedSelectedCardIndex);
}

assertCommandBoxShowsDefaultStyle();
assertCommandBoxAndResultDisplayShowsDefaultStyle();
assertStatusBarUnchanged();
}

Expand All @@ -147,7 +147,7 @@ private void assertCommandFailure(String command, String expectedResultMessage)
executeCommand(command);
assertApplicationDisplaysExpected(command, expectedResultMessage, expectedModel);
assertSelectedCardUnchanged();
assertCommandBoxShowsErrorStyle();
assertCommandBoxAndResultDisplayShowsErrorStyle();
assertStatusBarUnchanged();
}
}

0 comments on commit 0357510

Please sign in to comment.