1818
1919import seedu .address .commons .core .Messages ;
2020import seedu .address .commons .core .index .Index ;
21- import seedu .address .logic .commands .EditCommand .EditPersonDescriptor ;
21+ import seedu .address .logic .commands .ModifyCommand .EditPersonDescriptor ;
2222import seedu .address .model .AddressBook ;
2323import seedu .address .model .Model ;
2424import seedu .address .model .ModelManager ;
2828import seedu .address .testutil .PersonBuilder ;
2929
3030/**
31- * Contains integration tests (interaction with the Model, UndoCommand and RedoCommand) and unit tests for EditCommand .
31+ * Contains integration tests (interaction with the Model, UndoCommand and RedoCommand) and unit tests for ModifyCommand .
3232 */
33- public class EditCommandTest {
33+ public class ModifyCommandTest {
3434
3535 private Model model = new ModelManager (getTypicalAddressBook (), new UserPrefs ());
3636
3737 @ Test
3838 public void execute_allFieldsSpecifiedUnfilteredList_success () {
3939 Person editedPerson = new PersonBuilder ().build ();
4040 EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder (editedPerson ).build ();
41- EditCommand editCommand = new EditCommand (INDEX_FIRST_PERSON , descriptor );
41+ ModifyCommand modifyCommand = new ModifyCommand (INDEX_FIRST_PERSON , descriptor );
4242
43- String expectedMessage = String .format (EditCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
43+ String expectedMessage = String .format (ModifyCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
4444
4545 Model expectedModel = new ModelManager (new AddressBook (model .getAddressBook ()), new UserPrefs ());
4646 expectedModel .setPerson (model .getFilteredPersonList ().get (0 ), editedPerson );
4747
48- assertCommandSuccess (editCommand , model , expectedMessage , expectedModel );
48+ assertCommandSuccess (modifyCommand , model , expectedMessage , expectedModel );
4949 }
5050
5151 @ Test
@@ -59,26 +59,26 @@ public void execute_someFieldsSpecifiedUnfilteredList_success() {
5959
6060 EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder ().withName (VALID_NAME_BOB )
6161 .withPhone (VALID_PHONE_BOB ).withTags (VALID_TAG_HUSBAND ).build ();
62- EditCommand editCommand = new EditCommand (indexLastPerson , descriptor );
62+ ModifyCommand modifyCommand = new ModifyCommand (indexLastPerson , descriptor );
6363
64- String expectedMessage = String .format (EditCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
64+ String expectedMessage = String .format (ModifyCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
6565
6666 Model expectedModel = new ModelManager (new AddressBook (model .getAddressBook ()), new UserPrefs ());
6767 expectedModel .setPerson (lastPerson , editedPerson );
6868
69- assertCommandSuccess (editCommand , model , expectedMessage , expectedModel );
69+ assertCommandSuccess (modifyCommand , model , expectedMessage , expectedModel );
7070 }
7171
7272 @ Test
7373 public void execute_noFieldSpecifiedUnfilteredList_success () {
74- EditCommand editCommand = new EditCommand (INDEX_FIRST_PERSON , new EditPersonDescriptor ());
74+ ModifyCommand modifyCommand = new ModifyCommand (INDEX_FIRST_PERSON , new EditPersonDescriptor ());
7575 Person editedPerson = model .getFilteredPersonList ().get (INDEX_FIRST_PERSON .getZeroBased ());
7676
77- String expectedMessage = String .format (EditCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
77+ String expectedMessage = String .format (ModifyCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
7878
7979 Model expectedModel = new ModelManager (new AddressBook (model .getAddressBook ()), new UserPrefs ());
8080
81- assertCommandSuccess (editCommand , model , expectedMessage , expectedModel );
81+ assertCommandSuccess (modifyCommand , model , expectedMessage , expectedModel );
8282 }
8383
8484 @ Test
@@ -87,24 +87,24 @@ public void execute_filteredList_success() {
8787
8888 Person personInFilteredList = model .getFilteredPersonList ().get (INDEX_FIRST_PERSON .getZeroBased ());
8989 Person editedPerson = new PersonBuilder (personInFilteredList ).withName (VALID_NAME_BOB ).build ();
90- EditCommand editCommand = new EditCommand (INDEX_FIRST_PERSON ,
90+ ModifyCommand modifyCommand = new ModifyCommand (INDEX_FIRST_PERSON ,
9191 new EditPersonDescriptorBuilder ().withName (VALID_NAME_BOB ).build ());
9292
93- String expectedMessage = String .format (EditCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
93+ String expectedMessage = String .format (ModifyCommand .MESSAGE_EDIT_PERSON_SUCCESS , editedPerson );
9494
9595 Model expectedModel = new ModelManager (new AddressBook (model .getAddressBook ()), new UserPrefs ());
9696 expectedModel .setPerson (model .getFilteredPersonList ().get (0 ), editedPerson );
9797
98- assertCommandSuccess (editCommand , model , expectedMessage , expectedModel );
98+ assertCommandSuccess (modifyCommand , model , expectedMessage , expectedModel );
9999 }
100100
101101 @ Test
102102 public void execute_duplicatePersonUnfilteredList_failure () {
103103 Person firstPerson = model .getFilteredPersonList ().get (INDEX_FIRST_PERSON .getZeroBased ());
104104 EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder (firstPerson ).build ();
105- EditCommand editCommand = new EditCommand (INDEX_SECOND_PERSON , descriptor );
105+ ModifyCommand modifyCommand = new ModifyCommand (INDEX_SECOND_PERSON , descriptor );
106106
107- assertCommandFailure (editCommand , model , EditCommand .MESSAGE_DUPLICATE_PERSON );
107+ assertCommandFailure (modifyCommand , model , ModifyCommand .MESSAGE_DUPLICATE_PERSON );
108108 }
109109
110110 @ Test
@@ -113,19 +113,19 @@ public void execute_duplicatePersonFilteredList_failure() {
113113
114114 // edit person in filtered list into a duplicate in address book
115115 Person personInList = model .getAddressBook ().getPersonList ().get (INDEX_SECOND_PERSON .getZeroBased ());
116- EditCommand editCommand = new EditCommand (INDEX_FIRST_PERSON ,
116+ ModifyCommand modifyCommand = new ModifyCommand (INDEX_FIRST_PERSON ,
117117 new EditPersonDescriptorBuilder (personInList ).build ());
118118
119- assertCommandFailure (editCommand , model , EditCommand .MESSAGE_DUPLICATE_PERSON );
119+ assertCommandFailure (modifyCommand , model , ModifyCommand .MESSAGE_DUPLICATE_PERSON );
120120 }
121121
122122 @ Test
123123 public void execute_invalidPersonIndexUnfilteredList_failure () {
124124 Index outOfBoundIndex = Index .fromOneBased (model .getFilteredPersonList ().size () + 1 );
125125 EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder ().withName (VALID_NAME_BOB ).build ();
126- EditCommand editCommand = new EditCommand (outOfBoundIndex , descriptor );
126+ ModifyCommand modifyCommand = new ModifyCommand (outOfBoundIndex , descriptor );
127127
128- assertCommandFailure (editCommand , model , Messages .MESSAGE_INVALID_PERSON_DISPLAYED_INDEX );
128+ assertCommandFailure (modifyCommand , model , Messages .MESSAGE_INVALID_PERSON_DISPLAYED_INDEX );
129129 }
130130
131131 /**
@@ -139,19 +139,19 @@ public void execute_invalidPersonIndexFilteredList_failure() {
139139 // ensures that outOfBoundIndex is still in bounds of address book list
140140 assertTrue (outOfBoundIndex .getZeroBased () < model .getAddressBook ().getPersonList ().size ());
141141
142- EditCommand editCommand = new EditCommand (outOfBoundIndex ,
142+ ModifyCommand modifyCommand = new ModifyCommand (outOfBoundIndex ,
143143 new EditPersonDescriptorBuilder ().withName (VALID_NAME_BOB ).build ());
144144
145- assertCommandFailure (editCommand , model , Messages .MESSAGE_INVALID_PERSON_DISPLAYED_INDEX );
145+ assertCommandFailure (modifyCommand , model , Messages .MESSAGE_INVALID_PERSON_DISPLAYED_INDEX );
146146 }
147147
148148 @ Test
149149 public void equals () {
150- final EditCommand standardCommand = new EditCommand (INDEX_FIRST_PERSON , DESC_AMY );
150+ final ModifyCommand standardCommand = new ModifyCommand (INDEX_FIRST_PERSON , DESC_AMY );
151151
152152 // same values -> returns true
153153 EditPersonDescriptor copyDescriptor = new EditPersonDescriptor (DESC_AMY );
154- EditCommand commandWithSameValues = new EditCommand (INDEX_FIRST_PERSON , copyDescriptor );
154+ ModifyCommand commandWithSameValues = new ModifyCommand (INDEX_FIRST_PERSON , copyDescriptor );
155155 assertTrue (standardCommand .equals (commandWithSameValues ));
156156
157157 // same object -> returns true
@@ -164,10 +164,10 @@ public void equals() {
164164 assertFalse (standardCommand .equals (new ClearCommand ()));
165165
166166 // different index -> returns false
167- assertFalse (standardCommand .equals (new EditCommand (INDEX_SECOND_PERSON , DESC_AMY )));
167+ assertFalse (standardCommand .equals (new ModifyCommand (INDEX_SECOND_PERSON , DESC_AMY )));
168168
169169 // different descriptor -> returns false
170- assertFalse (standardCommand .equals (new EditCommand (INDEX_FIRST_PERSON , DESC_BOB )));
170+ assertFalse (standardCommand .equals (new ModifyCommand (INDEX_FIRST_PERSON , DESC_BOB )));
171171 }
172172
173173}
0 commit comments