From 414c42742efef3526b4641311ec3dbb04efc05f8 Mon Sep 17 00:00:00 2001 From: gongg21 Date: Mon, 16 Oct 2023 17:32:45 +0800 Subject: [PATCH] Update test files --- .../java/seedu/address/logic/commands/EditCommand.java | 2 +- src/test/java/seedu/address/logic/LogicManagerTest.java | 8 +++----- .../seedu/address/logic/commands/CommandTestUtil.java | 6 ++---- .../address/logic/commands/EditStudentDescriptorTest.java | 3 ++- src/test/java/seedu/address/testutil/StudentBuilder.java | 4 ++-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 46f1c016911..7d73b98962f 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -234,7 +234,7 @@ public String toString() { .add("name", name) .add("course", course) .add("email", email) - .add("email", remark) + .add("remark", remark) .add("tags", tags) .toString(); } diff --git a/src/test/java/seedu/address/logic/LogicManagerTest.java b/src/test/java/seedu/address/logic/LogicManagerTest.java index e6050b9a617..fbc71c84850 100644 --- a/src/test/java/seedu/address/logic/LogicManagerTest.java +++ b/src/test/java/seedu/address/logic/LogicManagerTest.java @@ -3,9 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static seedu.address.logic.Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX; import static seedu.address.logic.Messages.MESSAGE_UNKNOWN_COMMAND; -import static seedu.address.logic.commands.CommandTestUtil.COURSE_DESC_AMY; -import static seedu.address.logic.commands.CommandTestUtil.EMAIL_DESC_AMY; -import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_AMY; +import static seedu.address.logic.commands.CommandTestUtil.*; import static seedu.address.testutil.Assert.assertThrows; import static seedu.address.testutil.TypicalStudents.AMY; @@ -165,8 +163,8 @@ public void saveStudentList(ReadOnlyStudentList studentList, Path filePath) // Triggers the saveAddressBook method by executing an add command String addCommand = AddCommand.COMMAND_WORD + NAME_DESC_AMY + COURSE_DESC_AMY - + EMAIL_DESC_AMY; - Student expectedStudent = new StudentBuilder(AMY).withTags().build(); + + EMAIL_DESC_AMY + TAG_DESC_AVERAGE; + Student expectedStudent = new StudentBuilder(AMY).build(); ModelManager expectedModel = new ModelManager(); expectedModel.addStudent(expectedStudent); assertCommandFailure(addCommand, CommandException.class, expectedMessage, expectedModel); diff --git a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java index c5cd5235e78..9caac1c69b9 100644 --- a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java +++ b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java @@ -2,10 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static seedu.address.logic.parser.CliSyntax.PREFIX_COURSE; -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_TAG; +import static seedu.address.logic.parser.CliSyntax.*; import static seedu.address.testutil.Assert.assertThrows; import java.util.ArrayList; @@ -51,6 +48,7 @@ public class CommandTestUtil { public static final String EMAIL_DESC_AMY = " " + PREFIX_EMAIL + VALID_EMAIL_AMY; public static final String EMAIL_DESC_BOB = " " + PREFIX_EMAIL + VALID_EMAIL_BOB; public static final String EMAIL_DESC_CLARA = " " + PREFIX_EMAIL + VALID_EMAIL_CLARA; + public static final String REMARK_DESC_AMY = " " + PREFIX_REMARK + VALID_REMARK_AMY; public static final String TAG_DESC_AVERAGE = " " + PREFIX_TAG + VALID_TAG_AVERAGE; public static final String TAG_DESC_GOOD = " " + PREFIX_TAG + VALID_TAG_GOOD; public static final String TAG_DESC_POOR = " " + PREFIX_TAG + VALID_TAG_POOR; diff --git a/src/test/java/seedu/address/logic/commands/EditStudentDescriptorTest.java b/src/test/java/seedu/address/logic/commands/EditStudentDescriptorTest.java index 8ac45f5a779..70d3578c28b 100644 --- a/src/test/java/seedu/address/logic/commands/EditStudentDescriptorTest.java +++ b/src/test/java/seedu/address/logic/commands/EditStudentDescriptorTest.java @@ -58,7 +58,8 @@ public void toStringMethod() { String expected = EditStudentDescriptor.class.getCanonicalName() + "{name=" + editPersonDescriptor.getName().orElse(null) + ", course=" + editPersonDescriptor.getCourse().orElse(null) + ", email=" - + editPersonDescriptor.getEmail().orElse(null) + ", tags=" + + editPersonDescriptor.getEmail().orElse(null) + ", remark=" + + editPersonDescriptor.getRemark().orElse(null) + ", tags=" + editPersonDescriptor.getTags().orElse(null) + "}"; assertEquals(expected, editPersonDescriptor.toString()); } diff --git a/src/test/java/seedu/address/testutil/StudentBuilder.java b/src/test/java/seedu/address/testutil/StudentBuilder.java index 0dd16b29b45..0193cdc9d68 100644 --- a/src/test/java/seedu/address/testutil/StudentBuilder.java +++ b/src/test/java/seedu/address/testutil/StudentBuilder.java @@ -20,7 +20,7 @@ public class StudentBuilder { public static final String DEFAULT_NAME = "Amy Bee"; public static final String DEFAULT_COURSE = "CS2103T"; public static final String DEFAULT_EMAIL = "amy@gmail.com"; - public static final String DEFAULT_REMARK = "She likes aardvarks."; + public static final String DEFAULT_REMARK = "Likes skiing."; private Name name; private Course course; @@ -35,7 +35,7 @@ public StudentBuilder() { name = new Name(DEFAULT_NAME); course = new Course(DEFAULT_COURSE); email = new Email(DEFAULT_EMAIL); - remark = new Remark(DEFAULT_REMARK); + remark = new Remark(""); tags = new HashSet<>(); }