Skip to content

Commit

Permalink
Create test for RemarkCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
tsulim committed Mar 1, 2024
1 parent e058e5e commit 226de53
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/test/java/seedu/address/logic/commands/RemarkCommandTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package seedu.address.logic.commands;

import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON;
import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook;

import org.junit.jupiter.api.Test;

import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.UserPrefs;
import seedu.address.model.person.Person;
import seedu.address.model.person.Remark;
import seedu.address.testutil.PersonBuilder;

/**
* Contains integration tests (interaction with the Model) and unit tests for RemarkCommand.
*/
public class RemarkCommandTest {

private static final String REMARK_STUB = "Some remark";

private Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs());

@Test
public void execute_addRemarkUnfilteredList_success() {
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
Person editedPerson = new PersonBuilder(firstPerson).withRemark(REMARK_STUB).build();

RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON, new Remark(editedPerson.getRemark().value));

String expectedMessage = String.format(RemarkCommand.MESSAGE_ADD_REMARK_SUCCESS, editedPerson);

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
expectedModel.setPerson(firstPerson, editedPerson);

assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel);
}
}

0 comments on commit 226de53

Please sign in to comment.