diff --git a/src/main/java/seedu/address/logic/commands/LeaveCommand.java b/src/main/java/seedu/address/logic/commands/LeaveCommand.java index eb6bd25813f..e8817512175 100644 --- a/src/main/java/seedu/address/logic/commands/LeaveCommand.java +++ b/src/main/java/seedu/address/logic/commands/LeaveCommand.java @@ -24,7 +24,7 @@ public class LeaveCommand extends Command { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds leave months for an employee.\n" + "Parameters: INDEX (must be a positive integer) " + PREFIX_MONTH + "MONTHS\n" + "Format: MONTHS must be integers separated by commas without spaces. " - + "1 - Jan, 2 - Feb, ..., 12 - Dec.\n" + + "1: Jan, 2: Feb, ..., 12: Dec.\n" + "Example: " + COMMAND_WORD + " 1 " + PREFIX_MONTH + "3,-4 to add leave in March and remove leave in April."; diff --git a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java index 552fa60db05..75258652594 100644 --- a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java +++ b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java @@ -67,6 +67,7 @@ public class CommandTestUtil { 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 INVALID_LEAVE = "1+"; public static final String PREAMBLE_WHITESPACE = "\t \r \n"; public static final String PREAMBLE_NON_EMPTY = "NonEmptyPreamble"; diff --git a/src/test/java/seedu/address/model/person/LeaveTest.java b/src/test/java/seedu/address/model/person/LeaveTest.java new file mode 100644 index 00000000000..a213ecc8d7a --- /dev/null +++ b/src/test/java/seedu/address/model/person/LeaveTest.java @@ -0,0 +1,26 @@ +package seedu.address.model.person; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static seedu.address.logic.commands.CommandTestUtil.VALID_LEAVE; +import static seedu.address.logic.commands.CommandTestUtil.INVALID_LEAVE; +import static seedu.address.testutil.TypicalPersons.ALICE; +import static seedu.address.testutil.TypicalPersons.BOB; + +import org.junit.jupiter.api.Test; + +public class LeaveTest { + + @Test + public void validLeave() { + assertEquals(new Leave().leave, Leave.NO_LEAVE); + assertTrue(Leave.isValidLeave(ALICE.getLeave().leave)); + assertTrue(Leave.isValidLeave(BOB.getLeave().leave)); + assertTrue(Leave.isValidLeave(VALID_LEAVE)); + assertFalse(Leave.isValidLeave(INVALID_LEAVE)); + assertEquals(new Leave().toString(), "-"); + assertEquals(ALICE.getLeave().leave, "111101010101"); + assertEquals(ALICE.getLeave().toString(), "Jan, Feb, Mar, Apr, Jun, Aug, Oct, Dec"); + } +} diff --git a/src/test/java/seedu/address/model/person/PersonTest.java b/src/test/java/seedu/address/model/person/PersonTest.java index de93a5098f4..eb578347ef0 100644 --- a/src/test/java/seedu/address/model/person/PersonTest.java +++ b/src/test/java/seedu/address/model/person/PersonTest.java @@ -17,11 +17,6 @@ public class PersonTest { - @Test - public void asObservableList_modifyList_throwsUnsupportedOperationException() { - Person person = new PersonBuilder().build(); - } - @Test public void isSamePerson() { // same object -> returns true diff --git a/src/test/java/seedu/address/testutil/PersonBuilder.java b/src/test/java/seedu/address/testutil/PersonBuilder.java index b354bae3913..6de67a19782 100644 --- a/src/test/java/seedu/address/testutil/PersonBuilder.java +++ b/src/test/java/seedu/address/testutil/PersonBuilder.java @@ -145,7 +145,7 @@ public PersonBuilder withLeave(String leave) { } public Person build() { - return new Person(name, phone, email, address, salary, claimBudget, department, dob); + return new Person(name, phone, email, address, salary, claimBudget, department, dob, leave); } }