Skip to content

Commit

Permalink
Merge pull request #97 from avrilmohh/mark-assignment-tests
Browse files Browse the repository at this point in the history
Added mark assignment tests for equals and toString
  • Loading branch information
avrilmohh authored Oct 16, 2024
2 parents a8a2232 + bd8cd41 commit e7bfecb
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package seedu.address.logic.commands;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_ASSIGNMENT;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_STUDENT;
import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_STUDENT;

import java.util.ArrayList;

Expand Down Expand Up @@ -71,4 +74,39 @@ public void execute_invalidAssignmentIndex_markFailure() {
String expectedMessage = Messages.MESSAGE_INVALID_ASSIGNMENT_INDEX;
assertCommandFailure(markAssignmentCommand, model, expectedMessage);
}

@Test
public void equals() {
MarkAssignmentCommand markFirstCommand = new MarkAssignmentCommand(INDEX_FIRST_STUDENT,
INDEX_FIRST_ASSIGNMENT);
MarkAssignmentCommand markSecondCommand = new MarkAssignmentCommand(INDEX_SECOND_STUDENT,
INDEX_FIRST_ASSIGNMENT);

// same object -> returns true
assertTrue(markFirstCommand.equals(markFirstCommand));

// same values -> returns true
MarkAssignmentCommand markFirstCommandCopy = new MarkAssignmentCommand(INDEX_FIRST_STUDENT,
INDEX_FIRST_ASSIGNMENT);
assertTrue(markFirstCommand.equals(markFirstCommandCopy));

// different types -> returns false
assertFalse(markFirstCommand.equals(1));

// null -> returns false
assertFalse(markFirstCommand.equals(null));

// different student -> returns false
assertFalse(markFirstCommand.equals(markSecondCommand));
}

@Test
public void toStringMethod() {
MarkAssignmentCommand markAssignmentCommand = new MarkAssignmentCommand(INDEX_FIRST_STUDENT,
INDEX_FIRST_ASSIGNMENT);
String expected = MarkAssignmentCommand.class.getCanonicalName() + "{studentIndex=" + INDEX_FIRST_STUDENT
+ ", assignmentIndex=" + INDEX_FIRST_ASSIGNMENT + "}";
assertEquals(expected, markAssignmentCommand.toString());
}

}

0 comments on commit e7bfecb

Please sign in to comment.