Skip to content

Commit

Permalink
Refine execute_delete_removesCorrectPerson()
Browse files Browse the repository at this point in the history
  • Loading branch information
damithc committed Sep 8, 2016
1 parent 0ea617f commit cfe069e
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions test/java/seedu/addressbook/logic/LogicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,28 +378,23 @@ public void execute_delete_removesCorrectPerson() throws Exception {
Person p2 = helper.generatePerson(2, true);
Person p3 = helper.generatePerson(3, true);

AddressBook expectedAB = new AddressBook();
expectedAB.addPerson(p1);
expectedAB.addPerson(p2);
expectedAB.addPerson(p3);
List<Person> threePresons = helper.generatePersonList(p1, p2, p3);

AddressBook expectedAB = helper.generateAddressBook(threePresons);
expectedAB.removePerson(p2);

List<Person> lastShownList = new ArrayList<>();
lastShownList.add(p1);
lastShownList.add(p2);
lastShownList.add(p3);

addressBook.addPerson(p1);
addressBook.addPerson(p2);
addressBook.addPerson(p3);
logic.setLastShownList(lastShownList);
CommandResult r = logic.execute("delete 2");
helper.addToAddressBook(addressBook, threePresons);
logic.setLastShownList(threePresons);

assertEquals(String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS, p2), r.feedbackToUser);
assertFalse(r.getRelevantPersons().isPresent());
assertLogicObjectStateEquals(expectedAB, lastShownList);
assertNonMutatingCommandBehavior("delete 2",
String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS, p2),
expectedAB,
false,
threePresons);
}


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

0 comments on commit cfe069e

Please sign in to comment.