Skip to content

Commit

Permalink
Merge 200399f into 59fef30
Browse files Browse the repository at this point in the history
  • Loading branch information
racheltanxueqi committed Mar 19, 2019
2 parents 59fef30 + 200399f commit d86fbbf
Show file tree
Hide file tree
Showing 22 changed files with 201 additions and 187 deletions.
Binary file added docs/images/UI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/Ui.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{
"_comment": "AddressBook save file which contains the same Person values as in TypicalPersons#getTypicalAddressBook()",
"persons" : [ {
"name" : "Alice Pauline",
"name" : "Achorvale CC",
"phone" : "94351253",
"email" : "alice@example.com",
"address" : "123, Jurong West Ave 6, #08-111",
"serial number": "A008844L",
"tagged" : [ "west" ]
}, {
"name" : "Benson Meier",
"name" : "Hwi Yoh CC",
"phone" : "98765432",
"email" : "johnd@example.com",
"address" : "311, Clementi Ave 2, #02-25",
"serial number": "A008855L",
"tagged" : [ "urgent", "west" ]
}, {
"name" : "Carl Kurz",
"name" : "Teck Ghee CC",
"phone" : "95352563",
"email" : "heinz@example.com",
"address" : "wall street",
"serial number": "A0223344X",
"tagged" : [ ]
}, {
"name" : "Daniel Meier",
"name" : "Ayer Rajah CC",
"phone" : "87652533",
"email" : "cornelia@example.com",
"address" : "10th street",
"serial number": "A008800L",
"tagged" : [ "west" ]
}, {
"name" : "Elle Meyer",
"name" : "Bukit Gombak CC",
"phone" : "9482224",
"email" : "werner@example.com",
"address" : "michegan ave",
"serial number": "A008811L",
"tagged" : [ ]
}, {
"name" : "Fiona Kunz",
"name" : "Cheng San CC",
"phone" : "9482427",
"email" : "lydia@example.com",
"address" : "little tokyo",
"serial number": "A008822L",
"tagged" : [ ]
}, {
"name" : "George Best",
"name" : "Jurong Green CC",
"phone" : "9482442",
"email" : "anna@example.com",
"address" : "4th street",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import static org.junit.Assert.assertTrue;
import static seedu.address.commons.core.Messages.MESSAGE_EQUIPMENTS_LISTED_OVERVIEW;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalEquipments.ALICE;
import static seedu.address.testutil.TypicalEquipments.BENSON;
import static seedu.address.testutil.TypicalEquipments.DANIEL;
import static seedu.address.testutil.TypicalEquipments.ACHORVALECC;
import static seedu.address.testutil.TypicalEquipments.AYERRAJAHCC;
import static seedu.address.testutil.TypicalEquipments.HWIYOHCC;
import static seedu.address.testutil.TypicalEquipments.getTypicalAddressBook;

import java.util.Arrays;
Expand Down Expand Up @@ -73,7 +73,7 @@ public void execute_multipleKeywords_multipleEquipmentsFound() {
EquipmentContainsKeywordsPredicate predicate = preparePredicate("west urgent");
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(new FilterCommand(predicate), model, commandHistory, expectedMessage, expectedModel);
assertEquals(Arrays.asList(ALICE, BENSON, DANIEL), model.getFilteredPersonList());
assertEquals(Arrays.asList(ACHORVALECC, HWIYOHCC, AYERRAJAHCC), model.getFilteredPersonList());
}
private EquipmentContainsKeywordsPredicate preparePredicate(String userInput) {
return new EquipmentContainsKeywordsPredicate(Arrays.asList(userInput.split("\\s+")));
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/seedu/address/logic/commands/FindCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import static org.junit.Assert.assertTrue;
import static seedu.address.commons.core.Messages.MESSAGE_EQUIPMENTS_LISTED_OVERVIEW;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalEquipments.CARL;
import static seedu.address.testutil.TypicalEquipments.ELLE;
import static seedu.address.testutil.TypicalEquipments.FIONA;
import static seedu.address.testutil.TypicalEquipments.BUKITGCC;
import static seedu.address.testutil.TypicalEquipments.CHENGSANCC;
import static seedu.address.testutil.TypicalEquipments.TECKGHEECC;
import static seedu.address.testutil.TypicalEquipments.getTypicalAddressBook;

import java.util.Arrays;
Expand Down Expand Up @@ -69,11 +69,11 @@ public void execute_zeroKeywords_noPersonFound() {
@Test
public void execute_multipleKeywords_multiplePersonsFound() {
String expectedMessage = String.format(MESSAGE_EQUIPMENTS_LISTED_OVERVIEW, 3);
NameContainsKeywordsPredicate predicate = preparePredicate("Kurz Elle Kunz");
NameContainsKeywordsPredicate predicate = preparePredicate("Ghee Bukit Cheng");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
assertCommandSuccess(command, model, commandHistory, expectedMessage, expectedModel);
assertEquals(Arrays.asList(CARL, ELLE, FIONA), model.getFilteredPersonList());
assertEquals(Arrays.asList(TECKGHEECC, BUKITGCC, CHENGSANCC), model.getFilteredPersonList());
}

/**
Expand Down
24 changes: 12 additions & 12 deletions src/test/java/seedu/address/model/EquipmentManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import static seedu.address.logic.commands.CommandTestUtil.VALID_ADDRESS_BOB;
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_HUSBAND;

import static seedu.address.testutil.TypicalEquipments.ALICE;
import static seedu.address.testutil.TypicalEquipments.ACHORVALECC;
import static seedu.address.testutil.TypicalEquipments.AMY;
import static seedu.address.testutil.TypicalEquipments.BOB;
import static seedu.address.testutil.TypicalEquipments.getTypicalAddressBook;
Expand Down Expand Up @@ -59,9 +59,9 @@ public void resetData_withValidReadOnlyAddressBook_replacesData() {
@Test
public void resetData_withDuplicatePersons_throwsDuplicatePersonException() {
// Two equipment with the same identity fields
Equipment editedAlice = new EquipmentBuilder(ALICE).withAddress(VALID_ADDRESS_BOB).withTags(VALID_TAG_HUSBAND)
.build();
List<Equipment> newEquipments = Arrays.asList(ALICE, editedAlice);
Equipment editedAlice = new EquipmentBuilder(ACHORVALECC).withAddress(VALID_ADDRESS_BOB)
.withTags(VALID_TAG_HUSBAND).build();
List<Equipment> newEquipments = Arrays.asList(ACHORVALECC, editedAlice);
EquipmentManagerStub newData = new EquipmentManagerStub(newEquipments);

thrown.expect(DuplicateEquipmentException.class);
Expand All @@ -76,20 +76,20 @@ public void hasPerson_nullPerson_throwsNullPointerException() {

@Test
public void hasPerson_personNotInAddressBook_returnsFalse() {
assertFalse(equipmentManager.hasPerson(ALICE));
assertFalse(equipmentManager.hasPerson(ACHORVALECC));
}

@Test
public void hasPerson_personInAddressBook_returnsTrue() {
equipmentManager.addPerson(ALICE);
assertTrue(equipmentManager.hasPerson(ALICE));
equipmentManager.addPerson(ACHORVALECC);
assertTrue(equipmentManager.hasPerson(ACHORVALECC));
}

@Test
public void hasPerson_personWithSameIdentityFieldsInAddressBook_returnsTrue() {
equipmentManager.addPerson(ALICE);
Equipment editedAlice = new EquipmentBuilder(ALICE).withAddress(VALID_ADDRESS_BOB).withTags(VALID_TAG_HUSBAND)
.build();
equipmentManager.addPerson(ACHORVALECC);
Equipment editedAlice = new EquipmentBuilder(ACHORVALECC).withAddress(VALID_ADDRESS_BOB)
.withTags(VALID_TAG_HUSBAND).build();
assertTrue(equipmentManager.hasPerson(editedAlice));
}

Expand All @@ -104,7 +104,7 @@ public void addListener_withInvalidationListener_listenerAdded() {
SimpleIntegerProperty counter = new SimpleIntegerProperty();
InvalidationListener listener = observable -> counter.set(counter.get() + 1);
equipmentManager.addListener(listener);
equipmentManager.addPerson(ALICE);
equipmentManager.addPerson(ACHORVALECC);
assertEquals(1, counter.get());
}

Expand All @@ -114,7 +114,7 @@ public void removeListener_withInvalidationListener_listenerRemoved() {
InvalidationListener listener = observable -> counter.set(counter.get() + 1);
equipmentManager.addListener(listener);
equipmentManager.removeListener(listener);
equipmentManager.addPerson(ALICE);
equipmentManager.addPerson(ACHORVALECC);
assertEquals(0, counter.get());
}

Expand Down
49 changes: 25 additions & 24 deletions src/test/java/seedu/address/model/ModelManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_HUSBAND;
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_UNUSED;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.testutil.TypicalEquipments.ALICE;
import static seedu.address.testutil.TypicalEquipments.ACHORVALECC;
import static seedu.address.testutil.TypicalEquipments.AMY;
import static seedu.address.testutil.TypicalEquipments.BENSON;
import static seedu.address.testutil.TypicalEquipments.BOB;
import static seedu.address.testutil.TypicalEquipments.HWIYOHCC;

import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -98,39 +98,39 @@ public void hasPerson_nullPerson_throwsNullPointerException() {

@Test
public void hasPerson_personNotInAddressBook_returnsFalse() {
assertFalse(modelManager.hasPerson(ALICE));
assertFalse(modelManager.hasPerson(ACHORVALECC));
}

@Test
public void hasPerson_personInAddressBook_returnsTrue() {
modelManager.addPerson(ALICE);
assertTrue(modelManager.hasPerson(ALICE));
modelManager.addPerson(ACHORVALECC);
assertTrue(modelManager.hasPerson(ACHORVALECC));
}

@Test
public void deletePerson_personIsSelectedAndFirstPersonInFilteredPersonList_selectionCleared() {
modelManager.addPerson(ALICE);
modelManager.setSelectedPerson(ALICE);
modelManager.deletePerson(ALICE);
modelManager.addPerson(ACHORVALECC);
modelManager.setSelectedPerson(ACHORVALECC);
modelManager.deletePerson(ACHORVALECC);
assertEquals(null, modelManager.getSelectedPerson());
}

@Test
public void deletePerson_personIsSelectedAndSecondPersonInFilteredPersonList_firstPersonSelected() {
modelManager.addPerson(ALICE);
modelManager.addPerson(ACHORVALECC);
modelManager.addPerson(BOB);
assertEquals(Arrays.asList(ALICE, BOB), modelManager.getFilteredPersonList());
assertEquals(Arrays.asList(ACHORVALECC, BOB), modelManager.getFilteredPersonList());
modelManager.setSelectedPerson(BOB);
modelManager.deletePerson(BOB);
assertEquals(ALICE, modelManager.getSelectedPerson());
assertEquals(ACHORVALECC, modelManager.getSelectedPerson());
}

@Test
public void setPerson_personIsSelected_selectedPersonUpdated() {
modelManager.addPerson(ALICE);
modelManager.setSelectedPerson(ALICE);
Equipment updatedAlice = new EquipmentBuilder(ALICE).withEmail(VALID_EMAIL_BOB).build();
modelManager.setPerson(ALICE, updatedAlice);
modelManager.addPerson(ACHORVALECC);
modelManager.setSelectedPerson(ACHORVALECC);
Equipment updatedAlice = new EquipmentBuilder(ACHORVALECC).withEmail(VALID_EMAIL_BOB).build();
modelManager.setPerson(ACHORVALECC, updatedAlice);
assertEquals(updatedAlice, modelManager.getSelectedPerson());
}

Expand All @@ -143,20 +143,21 @@ public void getFilteredPersonList_modifyList_throwsUnsupportedOperationException
@Test
public void setSelectedPerson_personNotInFilteredPersonList_throwsPersonNotFoundException() {
thrown.expect(EquipmentNotFoundException.class);
modelManager.setSelectedPerson(ALICE);
modelManager.setSelectedPerson(ACHORVALECC);
}

@Test
public void setSelectedPerson_personInFilteredPersonList_setsSelectedPerson() {
modelManager.addPerson(ALICE);
assertEquals(Collections.singletonList(ALICE), modelManager.getFilteredPersonList());
modelManager.setSelectedPerson(ALICE);
assertEquals(ALICE, modelManager.getSelectedPerson());
modelManager.addPerson(ACHORVALECC);
assertEquals(Collections.singletonList(ACHORVALECC), modelManager.getFilteredPersonList());
modelManager.setSelectedPerson(ACHORVALECC);
assertEquals(ACHORVALECC, modelManager.getSelectedPerson());
}

@Test
public void equals() {
EquipmentManager equipmentManager = new EquipmentManagerBuilder().withPerson(ALICE).withPerson(BENSON).build();
EquipmentManager equipmentManager = new EquipmentManagerBuilder().withPerson(ACHORVALECC)
.withPerson(HWIYOHCC).build();
EquipmentManager differentEquipmentManager = new EquipmentManager();
UserPrefs userPrefs = new UserPrefs();

Expand All @@ -177,10 +178,10 @@ public void equals() {
// different equipmentManager -> returns false
assertFalse(modelManager.equals(new ModelManager(differentEquipmentManager, userPrefs)));

// different filteredList -> returns false
String[] keywords = ALICE.getName().name.split("\\s+");
// different filteredList -> returns True
String[] keywords = ACHORVALECC.getName().name.split("\\s+");
modelManager.updateFilteredPersonList(new NameContainsKeywordsPredicate(Arrays.asList(keywords)));
assertFalse(modelManager.equals(new ModelManager(equipmentManager, userPrefs)));
assertTrue(modelManager.equals(new ModelManager(equipmentManager, userPrefs)));

// resets modelManager to initial state for upcoming tests
modelManager.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static seedu.address.testutil.TypicalEquipments.AMY;
import static seedu.address.testutil.TypicalEquipments.BOB;
import static seedu.address.testutil.TypicalEquipments.CARL;
import static seedu.address.testutil.TypicalEquipments.TECKGHEECC;

import java.util.Arrays;
import java.util.Collections;
Expand All @@ -20,7 +20,8 @@ public class VersionedEquipmentManagerTest {

private final ReadOnlyEquipmentManager addressBookWithAmy = new EquipmentManagerBuilder().withPerson(AMY).build();
private final ReadOnlyEquipmentManager addressBookWithBob = new EquipmentManagerBuilder().withPerson(BOB).build();
private final ReadOnlyEquipmentManager addressBookWithCarl = new EquipmentManagerBuilder().withPerson(CARL).build();
private final ReadOnlyEquipmentManager addressBookWithCarl = new EquipmentManagerBuilder()
.withPerson(TECKGHEECC).build();
private final ReadOnlyEquipmentManager emptyAddressBook = new EquipmentManagerBuilder().build();

@Test
Expand Down
Loading

0 comments on commit d86fbbf

Please sign in to comment.