Skip to content

Commit

Permalink
Add test to cover no piano pieces input
Browse files Browse the repository at this point in the history
  • Loading branch information
IzN432 committed Oct 18, 2024
1 parent 1a9281e commit d7ce9a8
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ public void execute_validIndexAndPianoPiece_success() {
assertCommandSuccess(command, model, commandResult, expectedModel);
}
@Test
public void execute_validIndexAndNoPianoPiece_success() {
Student student = model.getFilteredStudentList().get(INDEX_FIRST_STUDENT.getZeroBased());
Set<PianoPiece> studentPieces = student.getPianoPieces();

Set<PianoPiece> noPieces = Set.of();
UnassignPiecesCommand command = new UnassignPiecesCommand(INDEX_FIRST_STUDENT, noPieces);

Student updatedStudent = student.withRemovedPianoPieces(studentPieces);
Model expectedModel = new ModelManager(new StudentDirectory(model.getStudentDirectory()), new UserPrefs());
expectedModel.setStudent(model.getFilteredStudentList().get(0), updatedStudent);

CommandResult commandResult = new CommandResult(String.format(UnassignPiecesCommand.MESSAGE_SUCCESS,
Messages.format(studentPieces),
Messages.format(student)));

assertCommandSuccess(command, model, commandResult, expectedModel);
}
@Test
public void execute_indexOutOfBounds_failure() {
Index outOfBoundsIndex = Index.fromOneBased(model.getFilteredStudentList().size() + 1);
UnassignPiecesCommand command = new UnassignPiecesCommand(outOfBoundsIndex, validPianoPieces);
Expand Down

0 comments on commit d7ce9a8

Please sign in to comment.