Skip to content

Commit

Permalink
Update Check command success test draft
Browse files Browse the repository at this point in the history
  • Loading branch information
NatLeong committed Apr 13, 2024
1 parent 5dce7fa commit 4fead52
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
26 changes: 18 additions & 8 deletions src/test/java/seedu/address/logic/commands/CheckCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalPersons.ALICE;
import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook;
import static seedu.address.testutil.TypicalVisits.VISIT_ALICE;

import org.junit.jupiter.api.Test;

Expand All @@ -18,19 +18,28 @@
import seedu.address.model.UserPrefs;
import seedu.address.model.person.Nric;
import seedu.address.model.person.NricContainsKeywordsPredicate;
import seedu.address.model.visit.Visit;
import seedu.address.model.visit.VisitContainsNricPredicate;
import seedu.address.testutil.TypicalVisits;

public class CheckCommandTest {

private final Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs());
private final Model expectedModel = new ModelManager(getTypicalAddressBook(), new UserPrefs());
private final Model model = new ModelManager(TypicalVisits.getTypicalVisitAddressBook(), new UserPrefs());
private final Model expectedModel = new ModelManager(TypicalVisits.getTypicalVisitAddressBook(), new UserPrefs());

/*@Test
@Test
void execute_validVisitNric_success() {
String expectedMessage = String.format(MESSAGE_READ_PERSON_SUCCESS, Messages.formatCheck(ALICE));
CheckCommand command = new CheckCommand(ALICE.getNric());
expectedModel.updateFilteredPersonList(new NricContainsKeywordsPredicate(ALICE.getNric().toString()));
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(ALICE.getName()).append(" (NRIC: ").append(VISIT_ALICE.getNric()).append("):\n");
stringBuilder.append(Messages.formatCheck(VISIT_ALICE)).append("\n");
stringBuilder.append(Messages.formatCheck(TypicalVisits.VISIT_ALICE_2)).append("\n");
stringBuilder.append(Messages.formatCheck(TypicalVisits.VISIT_ALICE_3)).append("\n");
String expectedMessage = String.format(MESSAGE_READ_PERSON_SUCCESS, stringBuilder);
CheckCommand command = new CheckCommand(VISIT_ALICE.getNric());
expectedModel.updateFilteredPersonList(new NricContainsKeywordsPredicate(VISIT_ALICE.getNric().toString()));
expectedModel.updateFilteredVisitList(new VisitContainsNricPredicate(VISIT_ALICE.getNric().toString()));
assertCommandSuccess(command, model, expectedMessage, expectedModel);
}*/
}

@Test
void execute_invalidVisitNric_success() {
Expand Down Expand Up @@ -75,4 +84,5 @@ void testToString() {
String expected = CheckCommand.class.getCanonicalName() + "{nric=" + ALICE.getNric() + "}";
assertEquals(expected, checkCommand.toString());
}

}
18 changes: 14 additions & 4 deletions src/test/java/seedu/address/testutil/TypicalVisits.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ public class TypicalVisits {
.withSymptom("Fever, Headache, Nausea, Vomiting").withDiagnosis("Dengue").withStatus("UNWELL").build();
public static final Visit VISIT_ALICE_3 = new VisitBuilder().withNric("T0139571B").withDateOfVisit("2024-03-23")
.withSymptom("Dark Urine, Joint pain, Pale stool").withDiagnosis("Hepatitis B").withStatus("PENDING").build();
public static final Visit VISIT_BENSON_3 =
new VisitBuilder().withNric("T0439571C").withDateOfVisit("2023-01-02").withSymptom("Headache")
public static final Visit VISIT_BENSON_3 = new VisitBuilder().withNric("T0439571C").withDateOfVisit("2023-01-02").withSymptom("Headache")
.withDiagnosis("NIL").withStatus("HEALTHY").build();
public static final Visit VISIT_CARL_3 =
new VisitBuilder().withNric("T0284994B").withDateOfVisit("2024-10-24").withSymptom("Slight Headache")
new VisitBuilder().withNric("T0284994B").withDateOfVisit("2024-10-29").withSymptom("Slight Headache")
.withDiagnosis("Recovered").withStatus("HEALTHY").build();

// Manually added - Person's details found in {@code CommandTestUtil}
Expand All @@ -62,14 +61,25 @@ private TypicalVisits() {
/**
* Returns an {@code AddressBook} with all the typical visits.
*/
public static ImmuniMate getTypicalAddressBook() {
public ImmuniMate getTypicalAddressBook() {
ImmuniMate ab = new ImmuniMate();
for (Visit visit : getTypicalVisits()) {
ab.addVisit(visit);
}
return ab;
}

/**
* Returns an {@code AddressBook} with all the typical visits and typical persons.
*/
public static ImmuniMate getTypicalVisitAddressBook() {
ImmuniMate ab = TypicalPersons.getTypicalAddressBook();
for (Visit visit : getTypicalVisits()) {
ab.addVisit(visit);
}
return ab;
}

public static List<Visit> getTypicalVisits() {
return new ArrayList<>(
Arrays.asList(VISIT_ALICE, VISIT_ALICE_2, VISIT_ALICE_3, VISIT_BENSON, VISIT_BENSON_2, VISIT_BENSON_3,
Expand Down

0 comments on commit 4fead52

Please sign in to comment.