From eec28c3bb7b03811b7cd20955be0e5d69b5f3792 Mon Sep 17 00:00:00 2001 From: alfaloo Date: Fri, 12 Apr 2024 21:36:56 +0800 Subject: [PATCH 1/2] Change data and log file names --- src/main/java/seedu/address/commons/core/LogsCenter.java | 2 +- src/main/java/seedu/address/model/UserPrefs.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/commons/core/LogsCenter.java b/src/main/java/seedu/address/commons/core/LogsCenter.java index 8cf8e15a0f0..aa8a6405cfc 100644 --- a/src/main/java/seedu/address/commons/core/LogsCenter.java +++ b/src/main/java/seedu/address/commons/core/LogsCenter.java @@ -20,7 +20,7 @@ public class LogsCenter { private static final int MAX_FILE_COUNT = 5; private static final int MAX_FILE_SIZE_IN_BYTES = (int) (Math.pow(2, 20) * 5); // 5MB - private static final String LOG_FILE = "addressbook.log"; + private static final String LOG_FILE = "medicli.log"; private static final Logger logger; // logger for this class private static Logger baseLogger; // to be used as the parent of all other loggers created by this class. private static Level currentLogLevel = Level.INFO; diff --git a/src/main/java/seedu/address/model/UserPrefs.java b/src/main/java/seedu/address/model/UserPrefs.java index 6be655fb4c7..20036a239bc 100644 --- a/src/main/java/seedu/address/model/UserPrefs.java +++ b/src/main/java/seedu/address/model/UserPrefs.java @@ -14,7 +14,7 @@ public class UserPrefs implements ReadOnlyUserPrefs { private GuiSettings guiSettings = new GuiSettings(); - private Path addressBookFilePath = Paths.get("data" , "addressbook.json"); + private Path addressBookFilePath = Paths.get("data" , "medicli.json"); /** * Creates a {@code UserPrefs} with default values. From 999218e49e456118f3fdf74e74af5ee1b34e0797 Mon Sep 17 00:00:00 2001 From: alfaloo Date: Fri, 12 Apr 2024 22:07:45 +0800 Subject: [PATCH 2/2] Remove tag completely --- .../logic/commands/AddAppointmentCommand.java | 2 +- .../address/logic/commands/EditCommand.java | 2 - .../logic/parser/AddCommandParser.java | 60 ------------------ .../seedu/address/logic/parser/CliSyntax.java | 1 - .../logic/parser/EditCommandParser.java | 3 +- .../address/logic/parser/ParserUtil.java | 32 ---------- .../model/appointment/Appointment.java | 2 +- .../appointment/AppointmentDateTime.java | 4 +- .../java/seedu/address/model/tag/Tag.java | 62 ------------------- .../address/model/util/SampleDataUtil.java | 14 ----- .../address/storage/JsonAdaptedPerson.java | 4 -- .../seedu/address/storage/JsonAdaptedTag.java | 48 -------------- .../logic/commands/CommandTestUtil.java | 7 --- .../parser/AddDoctorCommandParserTest.java | 7 +-- .../parser/AddPatientCommandParserTest.java | 7 +-- .../address/logic/parser/ParserUtilTest.java | 53 ---------------- .../java/seedu/address/model/tag/TagTest.java | 26 -------- 17 files changed, 8 insertions(+), 326 deletions(-) delete mode 100644 src/main/java/seedu/address/logic/parser/AddCommandParser.java delete mode 100644 src/main/java/seedu/address/model/tag/Tag.java delete mode 100644 src/main/java/seedu/address/storage/JsonAdaptedTag.java delete mode 100644 src/test/java/seedu/address/model/tag/TagTest.java diff --git a/src/main/java/seedu/address/logic/commands/AddAppointmentCommand.java b/src/main/java/seedu/address/logic/commands/AddAppointmentCommand.java index 6c59a254fee..9b7008c606d 100644 --- a/src/main/java/seedu/address/logic/commands/AddAppointmentCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddAppointmentCommand.java @@ -23,7 +23,7 @@ public class AddAppointmentCommand extends Command { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds an appointment to the MediCLI system.\n" + "Parameters: " - + PREFIX_DATE + "DATE " + + PREFIX_DATE + "DATE-TIME " + PREFIX_DOCTORNRIC + "DOCTOR NRIC " + PREFIX_PATIENTNRIC + "PATIENT NRIC\n" + "Example: " + COMMAND_WORD + " " diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index a12b4484978..8375855ad64 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -31,8 +31,6 @@ import seedu.address.model.person.Phone; - - /** * Editcommand class enables user to edit a doctor or patient in the person list */ diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java deleted file mode 100644 index 23bfcae405e..00000000000 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ /dev/null @@ -1,60 +0,0 @@ -//package seedu.address.logic.parser; -// -//import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -//import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -//import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -//import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -//import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -//import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; -// -//import java.util.Set; -//import java.util.stream.Stream; -// -//import seedu.address.logic.commands.AddCommand; -//import seedu.address.logic.parser.exceptions.ParseException; -//import seedu.address.model.person.Address; -//import seedu.address.model.person.Email; -//import seedu.address.model.person.Name; -//import seedu.address.model.person.Phone; -//import seedu.address.model.tag.Tag; -// -///** -// * Parses input arguments and creates a new AddCommand object -// */ -//public class AddCommandParser implements Parser { -// -// /** -// * Parses the given {@code String} of arguments in the context of the AddCommand -// * and returns an AddCommand object for execution. -// * @throws ParseException if the user input does not conform the expected format -// */ -// public AddCommand parse(String args) throws ParseException { -// ArgumentMultimap argMultimap = -// ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG); -// -// if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) -// || !argMultimap.getPreamble().isEmpty()) { -// throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); -// } -// -// argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS); -// Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()); -// Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); -// Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); -// Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); -// Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); -// -// // Person person = new Person(name, phone, email, address, tagList); -// -// return new AddCommand(null); -// } -// -// /** -// * Returns true if none of the prefixes contains empty {@code Optional} values in the given -// * {@code ArgumentMultimap}. -// */ -// private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { -// return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); -// } -// -//} diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java index 6dbce5ff313..e37824284af 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -14,7 +14,6 @@ public class CliSyntax { public static final Prefix PREFIX_EMAIL = new Prefix("e/"); public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); - public static final Prefix PREFIX_TAG = new Prefix("t/"); public static final Prefix PREFIX_DATE = new Prefix("ad/"); public static final Prefix PREFIX_PATIENTNRIC = new Prefix("pn/"); diff --git a/src/main/java/seedu/address/logic/parser/EditCommandParser.java b/src/main/java/seedu/address/logic/parser/EditCommandParser.java index fc05e994d8a..fc49a617b46 100644 --- a/src/main/java/seedu/address/logic/parser/EditCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/EditCommandParser.java @@ -6,7 +6,6 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.EditCommand; @@ -26,7 +25,7 @@ public class EditCommandParser implements Parser { public EditCommand parse(String args) throws ParseException { requireNonNull(args); ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_NRIC, PREFIX_DOB, PREFIX_TAG); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_NRIC, PREFIX_DOB); Index index; diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index 14c337e9e35..fbb8b4f084d 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -2,10 +2,6 @@ import static java.util.Objects.requireNonNull; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - import seedu.address.commons.core.index.Index; import seedu.address.commons.util.StringUtil; import seedu.address.logic.parser.exceptions.ParseException; @@ -16,7 +12,6 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Nric; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; /** * Contains utility methods used for parsing strings in the various *Parser classes. @@ -152,33 +147,6 @@ public static Email parseEmail(String email) throws ParseException { return new Email(trimmedEmail); } - /** - * Parses a {@code String tag} into a {@code Tag}. - * Leading and trailing whitespaces will be trimmed. - * - * @throws ParseException if the given {@code tag} is invalid. - */ - public static Tag parseTag(String tag) throws ParseException { - requireNonNull(tag); - String trimmedTag = tag.trim(); - if (!Tag.isValidTagName(trimmedTag)) { - throw new ParseException(Tag.MESSAGE_CONSTRAINTS); - } - return new Tag(trimmedTag); - } - - /** - * Parses {@code Collection tags} into a {@code Set}. - */ - public static Set parseTags(Collection tags) throws ParseException { - requireNonNull(tags); - final Set tagSet = new HashSet<>(); - for (String tagName : tags) { - tagSet.add(parseTag(tagName)); - } - return tagSet; - } - /** * Parses AppointmentDate from string to return an AppointmentDate object * @param apptDateTime String to parse diff --git a/src/main/java/seedu/address/model/appointment/Appointment.java b/src/main/java/seedu/address/model/appointment/Appointment.java index 0225c4055fd..ff73471f87c 100644 --- a/src/main/java/seedu/address/model/appointment/Appointment.java +++ b/src/main/java/seedu/address/model/appointment/Appointment.java @@ -17,7 +17,7 @@ public class Appointment { private static final String MESSAGE_CONSTRAINTS_INVALID_DATE = - "Appointment should be made with a date today onwards"; + "Appointment should be made with a date-time today onwards"; // The doctor in charge of the appointment private Nric doctorNric; diff --git a/src/main/java/seedu/address/model/appointment/AppointmentDateTime.java b/src/main/java/seedu/address/model/appointment/AppointmentDateTime.java index b3eb74f5f5c..d4371ea1cd6 100644 --- a/src/main/java/seedu/address/model/appointment/AppointmentDateTime.java +++ b/src/main/java/seedu/address/model/appointment/AppointmentDateTime.java @@ -14,7 +14,7 @@ public class AppointmentDateTime { // Message to output in case constraints are not met public static final String MESSAGE_CONSTRAINTS = - "Appointment date should be in the format of yyyy-MM-dd HH:mm."; + "Appointment date-time should be in the format of yyyy-MM-dd HH:mm."; // Variable storing appointment date in a local datetime instance public final LocalDateTime appointmentDateTime; @@ -48,8 +48,6 @@ public static boolean isValidDate(String dateStr) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); try { LocalDateTime temp = LocalDateTime.parse(dateStr, formatter); - //LocalDate today = LocalDate.now(); - //return temp.isAfter(today); } catch (DateTimeParseException e) { return false; } diff --git a/src/main/java/seedu/address/model/tag/Tag.java b/src/main/java/seedu/address/model/tag/Tag.java deleted file mode 100644 index f1a0d4e233b..00000000000 --- a/src/main/java/seedu/address/model/tag/Tag.java +++ /dev/null @@ -1,62 +0,0 @@ -package seedu.address.model.tag; - -import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; - -/** - * Represents a Tag in the address book. - * Guarantees: immutable; name is valid as declared in {@link #isValidTagName(String)} - */ -public class Tag { - - public static final String MESSAGE_CONSTRAINTS = "Tags names should be alphanumeric"; - public static final String VALIDATION_REGEX = "\\p{Alnum}+"; - - public final String tagName; - - /** - * Constructs a {@code Tag}. - * - * @param tagName A valid tag name. - */ - public Tag(String tagName) { - requireNonNull(tagName); - checkArgument(isValidTagName(tagName), MESSAGE_CONSTRAINTS); - this.tagName = tagName; - } - - /** - * Returns true if a given string is a valid tag name. - */ - public static boolean isValidTagName(String test) { - return test.matches(VALIDATION_REGEX); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof Tag)) { - return false; - } - - Tag otherTag = (Tag) other; - return tagName.equals(otherTag.tagName); - } - - @Override - public int hashCode() { - return tagName.hashCode(); - } - - /** - * Format state as text for viewing. - */ - public String toString() { - return '[' + tagName + ']'; - } - -} diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 27cee70e443..c1e060f7356 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -1,9 +1,5 @@ package seedu.address.model.util; -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; - import seedu.address.model.AddressBook; import seedu.address.model.ReadOnlyAddressBook; import seedu.address.model.person.DoB; @@ -12,7 +8,6 @@ import seedu.address.model.person.Patient; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; /** * Contains utility methods for populating {@code AddressBook} with sample data. @@ -51,13 +46,4 @@ public static ReadOnlyAddressBook getSampleAddressBook() { return sampleAb; } - /** - * Returns a tag set containing the list of strings given. - */ - public static Set getTagSet(String... strings) { - return Arrays.stream(strings) - .map(Tag::new) - .collect(Collectors.toSet()); - } - } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index fa386d49d54..675058e93d4 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -1,8 +1,5 @@ package seedu.address.storage; -import java.util.ArrayList; -import java.util.List; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -27,7 +24,6 @@ class JsonAdaptedPerson { private final String name; private final String dob; private final String phone; - private final List tags = new ArrayList<>(); /** * Constructs a {@code JsonAdaptedPerson} with the given person details. diff --git a/src/main/java/seedu/address/storage/JsonAdaptedTag.java b/src/main/java/seedu/address/storage/JsonAdaptedTag.java deleted file mode 100644 index 0df22bdb754..00000000000 --- a/src/main/java/seedu/address/storage/JsonAdaptedTag.java +++ /dev/null @@ -1,48 +0,0 @@ -package seedu.address.storage; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.tag.Tag; - -/** - * Jackson-friendly version of {@link Tag}. - */ -class JsonAdaptedTag { - - private final String tagName; - - /** - * Constructs a {@code JsonAdaptedTag} with the given {@code tagName}. - */ - @JsonCreator - public JsonAdaptedTag(String tagName) { - this.tagName = tagName; - } - - /** - * Converts a given {@code Tag} into this class for Jackson use. - */ - public JsonAdaptedTag(Tag source) { - tagName = source.tagName; - } - - @JsonValue - public String getTagName() { - return tagName; - } - - /** - * Converts this Jackson-friendly adapted tag object into the model's {@code Tag} object. - * - * @throws IllegalValueException if there were any data constraints violated in the adapted tag. - */ - public Tag toModelType() throws IllegalValueException { - if (!Tag.isValidTagName(tagName)) { - throw new IllegalValueException(Tag.MESSAGE_CONSTRAINTS); - } - return new Tag(tagName); - } - -} diff --git a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java index 88b20e7cdee..2fbcea72f1e 100644 --- a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java +++ b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java @@ -8,7 +8,6 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import static seedu.address.testutil.Assert.assertThrows; import java.text.SimpleDateFormat; @@ -59,20 +58,14 @@ public class CommandTestUtil { public static final String DOB_DESC_BOB = " " + PREFIX_DOB + VALID_DOB_BOB; public static final String PHONE_DESC_AMY = " " + PREFIX_PHONE + VALID_PHONE_AMY; public static final String PHONE_DESC_BOB = " " + PREFIX_PHONE + VALID_PHONE_BOB; - public static final String TAG_DESC_FRIEND = " " + PREFIX_TAG + VALID_TAG_FRIEND; - public static final String TAG_DESC_HUSBAND = " " + PREFIX_TAG + VALID_TAG_HUSBAND; - public static final String INVALID_NRIC_DESC = " " + PREFIX_NRIC + "A0983"; public static final String INVALID_NAME_DESC = " " + PREFIX_NAME + "James&"; // '&' not allowed in names public static final String INVALID_DOB_DESC = " " + PREFIX_DOB + "22-03-2009"; public static final String INVALID_PHONE_DESC = " " + PREFIX_PHONE + "911a"; // 'a' not allowed in phones public static final String INVALID_EMAIL_DESC = " " + PREFIX_EMAIL + "bob!yahoo"; // missing '@' symbol public static final String INVALID_ADDRESS_DESC = " " + PREFIX_ADDRESS; // empty string not allowed for addresses - public static final String INVALID_TAG_DESC = " " + PREFIX_TAG + "hubby*"; // '*' not allowed in tags - public static final String PREAMBLE_WHITESPACE = "\t \r \n"; public static final String PREAMBLE_NON_EMPTY = "NonEmptyPreamble"; - public static final EditCommand.EditPersonDescriptor DESC_AMY; public static final EditCommand.EditPersonDescriptor DESC_BOB; diff --git a/src/test/java/seedu/address/logic/parser/AddDoctorCommandParserTest.java b/src/test/java/seedu/address/logic/parser/AddDoctorCommandParserTest.java index 792b2782e06..e79872f0ed0 100644 --- a/src/test/java/seedu/address/logic/parser/AddDoctorCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddDoctorCommandParserTest.java @@ -14,9 +14,6 @@ import static seedu.address.logic.commands.CommandTestUtil.PHONE_DESC_AMY; import static seedu.address.logic.commands.CommandTestUtil.PHONE_DESC_BOB; import static seedu.address.logic.commands.CommandTestUtil.PREAMBLE_NON_EMPTY; -//import static seedu.address.logic.commands.CommandTestUtil.PREAMBLE_WHITESPACE; -import static seedu.address.logic.commands.CommandTestUtil.TAG_DESC_FRIEND; -import static seedu.address.logic.commands.CommandTestUtil.TAG_DESC_HUSBAND; import static seedu.address.logic.commands.CommandTestUtil.VALID_DOB_BOB; import static seedu.address.logic.commands.CommandTestUtil.VALID_NAME_BOB; import static seedu.address.logic.commands.CommandTestUtil.VALID_NRIC_BOB; @@ -153,8 +150,8 @@ public void parse_invalidValue_failure() { DoB.MESSAGE_CONSTRAINTS); // invalid phone - assertParseFailure(parser, NRIC_DESC_BOB + NAME_DESC_BOB + DOB_DESC_BOB + INVALID_PHONE_DESC - + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, Phone.MESSAGE_CONSTRAINTS); + assertParseFailure(parser, NRIC_DESC_BOB + NAME_DESC_BOB + DOB_DESC_BOB + INVALID_PHONE_DESC, + Phone.MESSAGE_CONSTRAINTS); // two invalid values, only first invalid value reported assertParseFailure(parser, INVALID_NRIC_DESC + NAME_DESC_BOB + DOB_DESC_BOB + INVALID_PHONE_DESC, diff --git a/src/test/java/seedu/address/logic/parser/AddPatientCommandParserTest.java b/src/test/java/seedu/address/logic/parser/AddPatientCommandParserTest.java index bc92c368afd..d9b329c5bed 100644 --- a/src/test/java/seedu/address/logic/parser/AddPatientCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/AddPatientCommandParserTest.java @@ -14,9 +14,6 @@ import static seedu.address.logic.commands.CommandTestUtil.PHONE_DESC_AMY; import static seedu.address.logic.commands.CommandTestUtil.PHONE_DESC_BOB; import static seedu.address.logic.commands.CommandTestUtil.PREAMBLE_NON_EMPTY; -//import static seedu.address.logic.commands.CommandTestUtil.PREAMBLE_WHITESPACE; -import static seedu.address.logic.commands.CommandTestUtil.TAG_DESC_FRIEND; -import static seedu.address.logic.commands.CommandTestUtil.TAG_DESC_HUSBAND; import static seedu.address.logic.commands.CommandTestUtil.VALID_DOB_BOB; import static seedu.address.logic.commands.CommandTestUtil.VALID_NAME_BOB; import static seedu.address.logic.commands.CommandTestUtil.VALID_NRIC_BOB; @@ -153,8 +150,8 @@ public void parse_invalidValue_failure() { DoB.MESSAGE_CONSTRAINTS); // invalid phone - assertParseFailure(parser, NRIC_DESC_BOB + NAME_DESC_BOB + DOB_DESC_BOB + INVALID_PHONE_DESC - + TAG_DESC_HUSBAND + TAG_DESC_FRIEND, Phone.MESSAGE_CONSTRAINTS); + assertParseFailure(parser, NRIC_DESC_BOB + NAME_DESC_BOB + DOB_DESC_BOB + INVALID_PHONE_DESC, + Phone.MESSAGE_CONSTRAINTS); // two invalid values, only first invalid value reported assertParseFailure(parser, INVALID_NRIC_DESC + NAME_DESC_BOB + DOB_DESC_BOB + INVALID_PHONE_DESC, diff --git a/src/test/java/seedu/address/logic/parser/ParserUtilTest.java b/src/test/java/seedu/address/logic/parser/ParserUtilTest.java index 7f96a0fa79d..937fa85679e 100644 --- a/src/test/java/seedu/address/logic/parser/ParserUtilTest.java +++ b/src/test/java/seedu/address/logic/parser/ParserUtilTest.java @@ -1,16 +1,10 @@ package seedu.address.logic.parser; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static seedu.address.logic.parser.ParserUtil.MESSAGE_INVALID_INDEX; import static seedu.address.testutil.Assert.assertThrows; import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - import org.junit.jupiter.api.Test; import seedu.address.logic.parser.exceptions.ParseException; @@ -19,7 +13,6 @@ import seedu.address.model.person.Email; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; public class ParserUtilTest { private static final String INVALID_NAME = "R@chel"; @@ -149,52 +142,6 @@ public void parseEmail_validValueWithWhitespace_returnsTrimmedEmail() throws Exc assertEquals(expectedEmail, ParserUtil.parseEmail(emailWithWhitespace)); } - @Test - public void parseTag_null_throwsNullPointerException() { - assertThrows(NullPointerException.class, () -> ParserUtil.parseTag(null)); - } - - @Test - public void parseTag_invalidValue_throwsParseException() { - assertThrows(ParseException.class, () -> ParserUtil.parseTag(INVALID_TAG)); - } - - @Test - public void parseTag_validValueWithoutWhitespace_returnsTag() throws Exception { - Tag expectedTag = new Tag(VALID_TAG_1); - assertEquals(expectedTag, ParserUtil.parseTag(VALID_TAG_1)); - } - - @Test - public void parseTag_validValueWithWhitespace_returnsTrimmedTag() throws Exception { - String tagWithWhitespace = WHITESPACE + VALID_TAG_1 + WHITESPACE; - Tag expectedTag = new Tag(VALID_TAG_1); - assertEquals(expectedTag, ParserUtil.parseTag(tagWithWhitespace)); - } - - @Test - public void parseTags_null_throwsNullPointerException() { - assertThrows(NullPointerException.class, () -> ParserUtil.parseTags(null)); - } - - @Test - public void parseTags_collectionWithInvalidTags_throwsParseException() { - assertThrows(ParseException.class, () -> ParserUtil.parseTags(Arrays.asList(VALID_TAG_1, INVALID_TAG))); - } - - @Test - public void parseTags_emptyCollection_returnsEmptySet() throws Exception { - assertTrue(ParserUtil.parseTags(Collections.emptyList()).isEmpty()); - } - - @Test - public void parseTags_collectionWithValidTags_returnsTagSet() throws Exception { - Set actualTagSet = ParserUtil.parseTags(Arrays.asList(VALID_TAG_1, VALID_TAG_2)); - Set expectedTagSet = new HashSet(Arrays.asList(new Tag(VALID_TAG_1), new Tag(VALID_TAG_2))); - - assertEquals(expectedTagSet, actualTagSet); - } - @Test public void parseAppointmentDate_validDate_returnsAppointmentDate() throws ParseException { String date = "2024-09-02 11:02"; diff --git a/src/test/java/seedu/address/model/tag/TagTest.java b/src/test/java/seedu/address/model/tag/TagTest.java deleted file mode 100644 index 64d07d79ee2..00000000000 --- a/src/test/java/seedu/address/model/tag/TagTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package seedu.address.model.tag; - -import static seedu.address.testutil.Assert.assertThrows; - -import org.junit.jupiter.api.Test; - -public class TagTest { - - @Test - public void constructor_null_throwsNullPointerException() { - assertThrows(NullPointerException.class, () -> new Tag(null)); - } - - @Test - public void constructor_invalidTagName_throwsIllegalArgumentException() { - String invalidTagName = ""; - assertThrows(IllegalArgumentException.class, () -> new Tag(invalidTagName)); - } - - @Test - public void isValidTagName() { - // null tag name - assertThrows(NullPointerException.class, () -> Tag.isValidTagName(null)); - } - -}