Skip to content

Commit

Permalink
Merge pull request #248 from yashpola/branch-v1.4
Browse files Browse the repository at this point in the history
Revert illegal v1.4 modification
  • Loading branch information
headcube1 authored Apr 10, 2024
2 parents d8bba34 + 712045b commit 720422d
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class Messages {

public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_COMMAND = "Invalid command format or invalid parameters! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_PERSON_NOT_IN_LIST = "The person you are looking for is not on the list";
public static final String MESSAGE_APPLICANT_NOT_IN_LIST = "The applicant you are looking for is not on the list";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
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;
Expand Down Expand Up @@ -37,7 +37,7 @@ public AddApplicantPersonCommand parse(String args) throws ParseException {

if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND,
AddApplicantPersonCommand.MESSAGE_USAGE));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.AddApplicantStatusCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.ApplicantStatus;
Expand All @@ -26,7 +27,8 @@ public AddApplicantStatusCommand parse(String args) throws ParseException {
try {
phone = ParserUtil.parsePhone(argMultimap.getPreamble());
} catch (IllegalValueException ive) {
throw new ParseException(Phone.MESSAGE_CONSTRAINTS, ive);
throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND,
AddApplicantStatusCommand.MESSAGE_USAGE), ive);
}

ApplicantStatus applicantStatus = ParserUtil.parseApplicantStatus(argMultimap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.Messages.MESSAGE_NOT_DATE;
import static seedu.address.logic.Messages.MESSAGE_NOT_TIME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_APPLICANT;
Expand Down Expand Up @@ -43,8 +43,8 @@ public AddInterviewCommand parse(String args) throws ParseException {
if (!arePrefixesPresent(argMultimap, PREFIX_DESCRIPTION, PREFIX_DATE, PREFIX_START_TIME, PREFIX_END_TIME,
PREFIX_APPLICANT, PREFIX_INTERVIEWER)
|| !argMultimap.getPreamble().isEmpty()) {
logger.info("An error has occurred while parsing AddInterviewCommand: " + MESSAGE_INVALID_COMMAND_FORMAT);
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddInterviewCommand.MESSAGE_USAGE));
logger.info("An error has occurred while parsing AddInterviewCommand: " + MESSAGE_INVALID_COMMAND);
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND, AddInterviewCommand.MESSAGE_USAGE));
}

String description = argMultimap.getValue(PREFIX_DESCRIPTION).get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
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;
Expand Down Expand Up @@ -37,7 +37,7 @@ public AddInterviewerPersonCommand parse(String args) throws ParseException {

if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND,
AddInterviewerPersonCommand.MESSAGE_USAGE));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.Messages.MESSAGE_UNKNOWN_COMMAND;

import java.util.regex.Matcher;
Expand Down Expand Up @@ -47,7 +47,7 @@ public class AddressBookParser {
public Command parseCommand(String userInput) throws ParseException {
final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());
if (!matcher.matches()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND, HelpCommand.MESSAGE_USAGE));
}

final String commandWord = matcher.group("commandWord");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;

import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.parser.exceptions.ParseException;
Expand All @@ -22,7 +22,7 @@ public DeleteCommand parse(String args) throws ParseException {
return new DeleteCommand(phone);
} catch (ParseException pe) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE), pe);
String.format(MESSAGE_INVALID_COMMAND, DeleteCommand.MESSAGE_USAGE), pe);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;

import seedu.address.logic.commands.DeleteInterviewCommand;
import seedu.address.logic.parser.exceptions.ParseException;
Expand All @@ -22,7 +22,7 @@ public DeleteInterviewCommand parse(String args) throws ParseException {
return new DeleteInterviewCommand(x);
} catch (NumberFormatException e) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteInterviewCommand.MESSAGE_USAGE), e);
String.format(MESSAGE_INVALID_COMMAND, DeleteInterviewCommand.MESSAGE_USAGE), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.address.logic.parser;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;

import seedu.address.commons.exceptions.IllegalValueException;
Expand Down Expand Up @@ -37,7 +37,7 @@ public FilterPersonsByStatusCommand parse(String args) throws ParseException {
throw new ParseException(Status.MESSAGE_USAGE);
}
} catch (IllegalValueException ive) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND,
Status.MESSAGE_USAGE), ive);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;

import java.util.Arrays;

Expand All @@ -22,7 +22,7 @@ public FindEmailCommand parse(String args) throws ParseException {
String trimmedArgs = args.trim();
if (trimmedArgs.isEmpty()) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindEmailCommand.MESSAGE_USAGE));
String.format(MESSAGE_INVALID_COMMAND, FindEmailCommand.MESSAGE_USAGE));
}

String[] emailKeywords = trimmedArgs.split("\\s+");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;

import java.util.Arrays;

Expand All @@ -22,7 +22,7 @@ public FindNameCommand parse(String args) throws ParseException {
String trimmedArgs = args.trim();
if (trimmedArgs.isEmpty()) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindNameCommand.MESSAGE_USAGE));
String.format(MESSAGE_INVALID_COMMAND, FindNameCommand.MESSAGE_USAGE));
}

String[] nameKeywords = trimmedArgs.split("\\s+");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;

import java.util.Arrays;

Expand All @@ -22,7 +22,7 @@ public FindPhoneCommand parse(String args) throws ParseException {
String trimmedArgs = args.trim();
if (trimmedArgs.isEmpty()) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindPhoneCommand.MESSAGE_USAGE));
String.format(MESSAGE_INVALID_COMMAND, FindPhoneCommand.MESSAGE_USAGE));
}

String[] phoneKeywords = trimmedArgs.split("\\s+");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.address.logic.parser;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.parser.CliSyntax.PREFIX_REMARK;

import seedu.address.commons.core.index.Index;
Expand All @@ -27,7 +27,7 @@ public RemarkCommand parse(String args) throws ParseException {
try {
index = ParserUtil.parseIndex(argMultimap.getPreamble());
} catch (IllegalValueException ive) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, RemarkCommand.MESSAGE_USAGE), ive);
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND, RemarkCommand.MESSAGE_USAGE), ive);
}

String remark = argMultimap.getValue(PREFIX_REMARK).orElse("");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.commands.CommandTestUtil.EMAIL_DESC_AMY;
import static seedu.address.logic.commands.CommandTestUtil.EMAIL_DESC_BOB;
import static seedu.address.logic.commands.CommandTestUtil.INVALID_EMAIL_DESC;
Expand Down Expand Up @@ -62,7 +62,7 @@ public void parse_applicantOptionalFieldsMissing_success() {

@Test
public void parse_compulsoryFieldMissing_failure() {
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddApplicantPersonCommand.MESSAGE_USAGE);
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND, AddApplicantPersonCommand.MESSAGE_USAGE);

// missing name prefix
assertParseFailure(parser, VALID_NAME_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB,
Expand Down Expand Up @@ -103,6 +103,6 @@ public void parse_invalidValue_failure() {
// non-empty preamble
assertParseFailure(parser, PREAMBLE_NON_EMPTY + NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB
+ TAG_DESC_HUSBAND + TAG_DESC_FRIEND,
String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddApplicantPersonCommand.MESSAGE_USAGE));
String.format(MESSAGE_INVALID_COMMAND, AddApplicantPersonCommand.MESSAGE_USAGE));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import org.junit.jupiter.api.Test;

import seedu.address.logic.Messages;
import seedu.address.logic.commands.AddApplicantStatusCommand;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.UserPrefs;
import seedu.address.model.person.ApplicantStatus;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;

public class AddApplicantStatusCommandParserTest {
private AddApplicantStatusCommandParser parser = new AddApplicantStatusCommandParser();
Expand All @@ -33,7 +33,8 @@ public void parse_phoneSpecified_success() {

@Test
public void parse_incompleteFields_failure() {
String expectedMessage = String.format(Phone.MESSAGE_CONSTRAINTS);
String expectedMessage = String.format(Messages.MESSAGE_INVALID_COMMAND,
AddApplicantStatusCommand.MESSAGE_USAGE);

// no parameters
assertParseFailure(parser, AddApplicantStatusCommand.COMMAND_WORD, expectedMessage);
Expand All @@ -50,6 +51,7 @@ public void parse_invalidValues_failure() {
ApplicantStatus.MESSAGE_CONSTRAINTS);

// invalid phone
assertParseFailure(parser, "1" + " " + PREFIX_STATUS + "resume review", Phone.MESSAGE_CONSTRAINTS);
assertParseFailure(parser, "1" + " " + PREFIX_STATUS + "resume review",
String.format(Messages.MESSAGE_INVALID_COMMAND, AddApplicantStatusCommand.MESSAGE_USAGE));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.Messages.MESSAGE_NOT_DATE;
import static seedu.address.logic.Messages.MESSAGE_NOT_TIME;
import static seedu.address.logic.commands.CommandTestUtil.APPLICANT_PHONE;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void parse_interviewAllFieldsPresent_success() {

@Test
public void parse_compulsoryFieldMissing_failure() {
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddInterviewCommand.MESSAGE_USAGE);
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND, AddInterviewCommand.MESSAGE_USAGE);

// missing description prefix
assertParseFailure(parser, INTERVIEW_DATE + START_TIME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.commands.CommandTestUtil.EMAIL_DESC_BOB;
import static seedu.address.logic.commands.CommandTestUtil.EMAIL_DESC_CUBE;
import static seedu.address.logic.commands.CommandTestUtil.INVALID_EMAIL_DESC;
Expand Down Expand Up @@ -61,7 +61,7 @@ public void parse_interviewerOptionalFieldsMissing_success() {

@Test
public void parse_compulsoryFieldMissing_failure() {
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT,
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND,
AddInterviewerPersonCommand.MESSAGE_USAGE);

// missing name prefix
Expand Down Expand Up @@ -102,6 +102,6 @@ public void parse_invalidValue_failure() {
// non-empty preamble
assertParseFailure(parser, PREAMBLE_NON_EMPTY + NAME_DESC_BOB + PHONE_DESC_BOB + EMAIL_DESC_BOB
+ TAG_DESC_HUSBAND + TAG_DESC_FRIEND,
String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddInterviewerPersonCommand.MESSAGE_USAGE));
String.format(MESSAGE_INVALID_COMMAND, AddInterviewerPersonCommand.MESSAGE_USAGE));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.Messages.MESSAGE_UNKNOWN_COMMAND;
import static seedu.address.logic.parser.CliSyntax.PREFIX_REMARK;
import static seedu.address.testutil.Assert.assertThrows;
Expand Down Expand Up @@ -171,7 +171,7 @@ public void parseCommand_remark() throws Exception {

@Test
public void parseCommand_unrecognisedInput_throwsParseException() {
assertThrows(ParseException.class, String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE), ()
assertThrows(ParseException.class, String.format(MESSAGE_INVALID_COMMAND, HelpCommand.MESSAGE_USAGE), ()
-> parser.parseCommand(""));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess;

Expand All @@ -27,6 +27,6 @@ public void parse_validArgs_returnsDeleteCommand() {

@Test
public void parse_invalidArgs_throwsParseException() {
assertParseFailure(parser, "a", String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE));
assertParseFailure(parser, "a", String.format(MESSAGE_INVALID_COMMAND, DeleteCommand.MESSAGE_USAGE));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess;

Expand All @@ -26,7 +26,7 @@ public void parse_validArgs_returnsDeleteCommand() {

@Test
public void parse_invalidArgs_throwsParseException() {
assertParseFailure(parser, "a", String.format(MESSAGE_INVALID_COMMAND_FORMAT,
assertParseFailure(parser, "a", String.format(MESSAGE_INVALID_COMMAND,
DeleteInterviewCommand.MESSAGE_USAGE));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess;

Expand All @@ -16,13 +16,13 @@ public class FilterPersonsByStatusCommandParserTest {

@Test
public void parse_emptyArg_throwsParseException() {
assertParseFailure(parser, " ", String.format(MESSAGE_INVALID_COMMAND_FORMAT,
assertParseFailure(parser, " ", String.format(MESSAGE_INVALID_COMMAND,
Status.MESSAGE_USAGE));
}

@Test
public void parse_invalidArg_throwsParseException() {
assertParseFailure(parser, "nonsense status", String.format(MESSAGE_INVALID_COMMAND_FORMAT,
assertParseFailure(parser, "nonsense status", String.format(MESSAGE_INVALID_COMMAND,
Status.MESSAGE_USAGE));
}

Expand Down
Loading

0 comments on commit 720422d

Please sign in to comment.