Skip to content

Commit

Permalink
Change remark validation, fix minor issues for addorder docs
Browse files Browse the repository at this point in the history
  • Loading branch information
guanquann committed Apr 3, 2024
1 parent c861b13 commit 6a08a60
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import seedu.address.model.person.Person;

/**
* Lists all persons in the address book to the user.
* Adds an order to a person identified by the index from the address book.
*/
public class AddOrderCommand extends Command {
public static final String COMMAND_WORD = "addorder";
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static Company parseCompany(String companyName) throws ParseException {
* Parses a {@code String date} into an {@code Date}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code date} is invalid.
* @throws ParseException if the given {@code Date} is invalid.
*/
public static Date parseDate(String date) throws ParseException {
requireNonNull(date);
Expand All @@ -131,7 +131,7 @@ public static Date parseDate(String date) throws ParseException {
/**
* Parses a {@code String remark} into a {@code Remark}.
*
* @throws ParseException if the given {@code remark} is invalid.
* @throws ParseException if the given {@code Remark} is invalid.
*/
public static Remark parseRemark(String remark) throws ParseException {
requireNonNull(remark);
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/seedu/address/model/order/Remark.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
*/
public class Remark {

public static final String MESSAGE_CONSTRAINTS =
"Remark should only contain alphanumeric characters, spaces, hyphens and/or apostrophes, "
+ "and it should not be blank";
public static final String MESSAGE_CONSTRAINTS = "Remark can take any values, and it should not be blank";

/*
* The first character of the remark must not be a whitespace,
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "[\\p{Alnum}'\\-][\\p{Alnum}'\\- ]*";
public static final String VALIDATION_REGEX = "[^\\s].*";

public final String remark;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/storage/JsonAdaptedOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class JsonAdaptedOrder {
private final String remark;

/**
* Constructs a {@code JsonAdaptedOrder} with the given {@code order}.
* Constructs a {@code JsonAdaptedOrder} with the given {@code Order}.
*/
@JsonCreator
public JsonAdaptedOrder(@JsonProperty("arrivalDate") String arrivalDate,
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/seedu/address/model/order/RemarkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public void isValidRemark() {
// invalid remark
assertFalse(Remark.isValidRemark("")); // empty string
assertFalse(Remark.isValidRemark(" ")); // spaces only
assertFalse(Remark.isValidRemark("^")); // only non-alphanumeric characters
assertFalse(Remark.isValidRemark("chick*n wings")); // contains non-alphanumeric characters

// valid remark
assertTrue(Remark.isValidRemark("chicken wings")); // alphabetical characters only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class JsonAdaptedOrderTest {
private static final String VALID_DATE = "2020-01-01";
private static final String VALID_REMARK = "100 chicken wings";
private static final String INVALID_DATE = "2020-13-01";
private static final String INVALID_REMARK = "****";
private static final String INVALID_REMARK = "";

private static final Order ORDER = new Order(new Date(VALID_DATE), new Remark(VALID_REMARK));

Expand Down

0 comments on commit 6a08a60

Please sign in to comment.