Skip to content

Commit

Permalink
Reorder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
damithc committed Sep 8, 2016
1 parent 4b4f500 commit 76556eb
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/java/seedu/addressbook/logic/LogicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,26 +191,6 @@ public void execute_addDuplicate_notAllowed() throws Exception {

}

/**
* Confirms the 'invalid argument index number behaviour' for the given command
* targeting a single person in the last shown list, using visible index.
* @param commandWord to test assuming it targets a single person in the last shown list based on visible index.
*/
private void assertInvalidIndexBehaviorForCommand(String commandWord) throws Exception {
String expectedMessage = Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX;
List<Person> lastShownList = new ArrayList<>();
TestDataHelper helper = new TestDataHelper();
lastShownList.add(helper.generatePerson(1, false));
lastShownList.add(helper.generatePerson(2, true));

logic.setLastShownList(lastShownList);

assertNonMutatingCommandBehavior(commandWord + " -1", expectedMessage, lastShownList);
assertNonMutatingCommandBehavior(commandWord + " 0", expectedMessage, lastShownList);
assertNonMutatingCommandBehavior(commandWord + " 3", expectedMessage, lastShownList);

}

@Test
public void execute_list_showsAllPersons() throws Exception {
// expectations
Expand Down Expand Up @@ -246,6 +226,26 @@ public void execute_view_invalidIndex() throws Exception {
assertInvalidIndexBehaviorForCommand("view");
}

/**
* Confirms the 'invalid argument index number behaviour' for the given command
* targeting a single person in the last shown list, using visible index.
* @param commandWord to test assuming it targets a single person in the last shown list based on visible index.
*/
private void assertInvalidIndexBehaviorForCommand(String commandWord) throws Exception {
String expectedMessage = Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX;
List<Person> lastShownList = new ArrayList<>();
TestDataHelper helper = new TestDataHelper();
lastShownList.add(helper.generatePerson(1, false));
lastShownList.add(helper.generatePerson(2, true));

logic.setLastShownList(lastShownList);

assertNonMutatingCommandBehavior(commandWord + " -1", expectedMessage, lastShownList);
assertNonMutatingCommandBehavior(commandWord + " 0", expectedMessage, lastShownList);
assertNonMutatingCommandBehavior(commandWord + " 3", expectedMessage, lastShownList);

}

@Test
public void execute_view_onlyShowsNonPrivate() throws Exception {
TestDataHelper helper = new TestDataHelper();
Expand Down

0 comments on commit 76556eb

Please sign in to comment.