Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren159 committed Oct 20, 2023
1 parent 291d956 commit 0f5c9f6
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 30 deletions.
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class Messages {
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_DUPLICATE_FIELDS = "Multiple values specified for the following single-valued field(s): ";
public static final String MESSAGE_DUPLICATE_FIELDS =
"Multiple values specified for the following single-valued field(s): ";

/**
* Returns an error message indicating the duplicate prefixes.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.StringUtil;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.shared.DateTime;
import seedu.address.model.person.Age;
import seedu.address.model.person.Allergy;
import seedu.address.model.person.BloodType;
Expand All @@ -20,6 +19,7 @@
import seedu.address.model.person.Name;
import seedu.address.model.person.Phone;
import seedu.address.model.record.Condition;
import seedu.address.model.shared.DateTime;
/**
* Contains utility methods used for parsing strings in the various *Parser classes.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class Person {
* Constructs a Person
*/
public Person(Name name, Email email, Phone phone, Gender gender, Age age,
BloodType bloodType, Set<Allergy> allergies, UniqueRecordList records, UniqueAppointmentList appointments, boolean isPinned) {
BloodType bloodType, Set<Allergy> allergies, UniqueRecordList records,
UniqueAppointmentList appointments, boolean isPinned) {
requireAllNonNull(name, phone, email, gender, age, allergies, isPinned, appointments);
this.name = name;
this.email = email;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/seedu/address/model/util/SampleDataUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import seedu.address.model.AddressBook;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.shared.DateTime;
import seedu.address.model.appointment.UniqueAppointmentList;
import seedu.address.model.person.Age;
import seedu.address.model.person.Allergy;
Expand All @@ -21,6 +20,7 @@
import seedu.address.model.record.Condition;
import seedu.address.model.record.Record;
import seedu.address.model.record.UniqueRecordList;
import seedu.address.model.shared.DateTime;


/**
Expand All @@ -31,7 +31,9 @@ public static Person[] getSamplePersons() {
return new Person[] {
new Person(new Name("Alex Yeoh"), new Email("[email protected]"), new Phone("87438807"),
new Gender("M"), new Age(12), new BloodType("A+"), getAllergySet("Peanuts"),
getRecordList(new Record(new DateTime("01-01-2001 1200"), getConditionList("Fever"))), getAppointmentList(new Appointment(new Name("Eye Exam"), new DateTime("01-01-2001 1200"))), true),
getRecordList(new Record(new DateTime("01-01-2001 1200"), getConditionList("Fever"))),
getAppointmentList(new Appointment(new Name("Eye Exam"), new DateTime("01-01-2001 1200"))),
true),
new Person(new Name("Bernice Yu"), new Email("[email protected]"), new Phone("99272758"),
new Gender("F"), new Age(31), new BloodType("B+"), getAllergySet("Dust", "Peanuts"),
new UniqueRecordList(), new UniqueAppointmentList(), false),
Expand Down Expand Up @@ -81,7 +83,6 @@ public static UniqueRecordList getRecordList(Record... records) {
recordList.setRecords(Arrays.asList(records));
return recordList;
}

public static UniqueAppointmentList getAppointmentList(Appointment... appointments) {
UniqueAppointmentList appointmentList = new UniqueAppointmentList();
appointmentList.setAppointments(Arrays.asList(appointments));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.shared.DateTime;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.shared.DateTime;

/**
* Jackson-friendly version of {@link Person}.
Expand Down Expand Up @@ -51,7 +51,8 @@ public Appointment toModelType() throws IllegalValueException {
final Name modelname = new Name(name);

if (dateTime == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, DateTime.class.getSimpleName()));
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT,
DateTime.class.getSimpleName()));
}
if (!DateTime.isValidDateTime(dateTime)) {
throw new IllegalValueException(DateTime.MESSAGE_CONSTRAINTS);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/storage/JsonAdaptedPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone
@JsonProperty("age") Integer age, @JsonProperty("bloodType") String bloodType,
@JsonProperty("allergies") List<JsonAdaptedAllergy> allergies,
@JsonProperty("records") List<JsonAdaptedRecord> records,
@JsonProperty("appointments") List<JsonAdaptedAppointment> appointments, @JsonProperty("isPinned") Boolean isPinned) {
@JsonProperty("appointments") List<JsonAdaptedAppointment> appointments,
@JsonProperty("isPinned") Boolean isPinned) {

this.name = name;
this.phone = phone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.shared.DateTime;
import seedu.address.model.person.Name;
import seedu.address.model.person.NameContainsKeywordsPredicate;
import seedu.address.model.person.Person;
import seedu.address.model.shared.DateTime;
import seedu.address.testutil.EditPersonDescriptorBuilder;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class EditCommandTest {
public void execute_allFieldsSpecifiedUnfilteredList_success() {
Person personToEdit = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
Person editedPerson = new PersonBuilder().withRecords(personToEdit.getRecords())
.withAppointments(personToEdit.getAppointments()).withIsPinned(personToEdit.isPinned()).build();
.withAppointments(personToEdit.getAppointments()).withIsPinned(personToEdit.isPinned()).build();

EditPersonDescriptor descriptor = new EditPersonDescriptorBuilder(editedPerson).build();
EditCommand editCommand = new EditCommand(INDEX_FIRST_PERSON, descriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.AddAppointmentCommand;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.shared.DateTime;
import seedu.address.model.person.Name;
import seedu.address.model.shared.DateTime;

public class AddAppointmentCommandParserTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import org.junit.jupiter.api.Test;

import seedu.address.model.appointment.Appointment;
import seedu.address.testutil.AppointmentBuilder;

public class AppointmentTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class DateTimeTest {

@Test
public void constructor_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> new DateTime((String)null));
assertThrows(NullPointerException.class, () -> new DateTime(null));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

import org.junit.jupiter.api.Test;

import seedu.address.model.appointment.Appointment;
import seedu.address.model.appointment.UniqueAppointmentList;
import seedu.address.model.appointment.exceptions.AppointmentNotFoundException;
import seedu.address.model.appointment.exceptions.DuplicateAppointmentException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.junit.jupiter.api.Test;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.model.shared.DateTime;
import seedu.address.model.person.Name;
import seedu.address.model.shared.DateTime;

public class JsonAdaptedAppointmentTest {
private static final String INVALID_NAME = "Sl@@p Study";
Expand Down
36 changes: 24 additions & 12 deletions src/test/java/seedu/address/storage/JsonAdaptedPersonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,55 +56,62 @@ public void toModelType_validPersonDetails_returnsPerson() throws Exception {
@Test
public void toModelType_invalidName_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(INVALID_NAME, VALID_EMAIL, VALID_PHONE,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = Name.MESSAGE_CONSTRAINTS;
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_nullName_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(null, VALID_EMAIL, VALID_PHONE,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName());
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_invalidPhone_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_EMAIL, INVALID_PHONE,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = Phone.MESSAGE_CONSTRAINTS;
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_nullPhone_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, null, VALID_EMAIL,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Phone.class.getSimpleName());
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_invalidEmail_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, INVALID_EMAIL,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = Email.MESSAGE_CONSTRAINTS;
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_nullEmail_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, null,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Email.class.getSimpleName());
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_invalidGender_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL,
INVALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
INVALID_GENDER, VALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = Gender.MESSAGE_CONSTRAINTS;
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}
Expand All @@ -120,31 +127,35 @@ public void toModelType_nullGender_throwsIllegalValueException() {
@Test
public void toModelType_invalidAge_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL,
VALID_GENDER, INVALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, INVALID_AGE, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = Age.MESSAGE_CONSTRAINTS;
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_nullAge_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL,
VALID_GENDER, null, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, null, VALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Age.class.getSimpleName());
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_invalidBloodType_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL,
VALID_GENDER, VALID_AGE, INVALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, INVALID_BLOODTYPE, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = BloodType.MESSAGE_CONSTRAINTS;
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}

@Test
public void toModelType_nullBloodType_throwsIllegalValueException() {
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL,
VALID_GENDER, VALID_AGE, null, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, null, VALID_ALLERGIES, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, BloodType.class.getSimpleName());
assertThrows(IllegalValueException.class, expectedMessage, person::toModelType);
}
Expand All @@ -154,7 +165,8 @@ public void toModelType_invalidTags_throwsIllegalValueException() {
List<JsonAdaptedAllergy> invalidAllergies = new ArrayList<>(VALID_ALLERGIES);
invalidAllergies.add(new JsonAdaptedAllergy(INVALID_ALLERGY));
JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL,
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, invalidAllergies, VALID_RECORDS, VALID_APPOINTMENTS, VALID_ISPINNED);
VALID_GENDER, VALID_AGE, VALID_BLOODTYPE, invalidAllergies, VALID_RECORDS, VALID_APPOINTMENTS,
VALID_ISPINNED);
assertThrows(IllegalValueException.class, person::toModelType);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package seedu.address.testutil;

import seedu.address.model.appointment.Appointment;
import seedu.address.model.shared.DateTime;
import seedu.address.model.person.Name;
import seedu.address.model.shared.DateTime;

/**
* A utility class to help with building Appointment objects.
Expand Down

0 comments on commit 0f5c9f6

Please sign in to comment.