From 359afaed0ea386ef551bb7ecb46f73aef038f31b Mon Sep 17 00:00:00 2001 From: DanielLai Date: Mon, 23 Sep 2024 21:10:09 +0800 Subject: [PATCH] Fix checkstyle violations --- .../address/logic/commands/RemarkCommand.java | 2 +- .../logic/parser/AddCommandParser.java | 3 ++- .../address/logic/parser/ParserUtil.java | 1 - .../logic/parser/RemarkCommandParser.java | 6 +---- .../address/model/person/Remark.java | 1 - .../address/model/util/SampleDataUtil.java | 24 +++++++++---------- .../hallpointer/address/ui/PersonCard.java | 5 ++-- .../logic/commands/RemarkCommandTest.java | 5 ++-- .../logic/parser/RemarkCommandParserTest.java | 2 +- .../storage/JsonAdaptedPersonTest.java | 12 ++++++---- 10 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/main/java/hallpointer/address/logic/commands/RemarkCommand.java b/src/main/java/hallpointer/address/logic/commands/RemarkCommand.java index ddc9a85ff4a..86ecf71eda1 100644 --- a/src/main/java/hallpointer/address/logic/commands/RemarkCommand.java +++ b/src/main/java/hallpointer/address/logic/commands/RemarkCommand.java @@ -87,4 +87,4 @@ public boolean equals(Object other) { return index.equals(e.index) && remark.equals(e.remark); } -} \ No newline at end of file +} diff --git a/src/main/java/hallpointer/address/logic/parser/AddCommandParser.java b/src/main/java/hallpointer/address/logic/parser/AddCommandParser.java index 5657be9b4e8..858cbe741f4 100644 --- a/src/main/java/hallpointer/address/logic/parser/AddCommandParser.java +++ b/src/main/java/hallpointer/address/logic/parser/AddCommandParser.java @@ -33,7 +33,8 @@ public class AddCommandParser implements Parser { */ public AddCommand parse(String args) throws ParseException { ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG, PREFIX_REMARK); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_REMARK, PREFIX_TAG); if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) || !argMultimap.getPreamble().isEmpty()) { diff --git a/src/main/java/hallpointer/address/logic/parser/ParserUtil.java b/src/main/java/hallpointer/address/logic/parser/ParserUtil.java index 6f064d74c59..673b7654a5f 100644 --- a/src/main/java/hallpointer/address/logic/parser/ParserUtil.java +++ b/src/main/java/hallpointer/address/logic/parser/ParserUtil.java @@ -13,7 +13,6 @@ import hallpointer.address.model.person.Email; import hallpointer.address.model.person.Name; import hallpointer.address.model.person.Phone; -import hallpointer.address.model.person.Remark; import hallpointer.address.model.tag.Tag; /** diff --git a/src/main/java/hallpointer/address/logic/parser/RemarkCommandParser.java b/src/main/java/hallpointer/address/logic/parser/RemarkCommandParser.java index e5104d67d6e..a5fd19ce691 100644 --- a/src/main/java/hallpointer/address/logic/parser/RemarkCommandParser.java +++ b/src/main/java/hallpointer/address/logic/parser/RemarkCommandParser.java @@ -1,10 +1,6 @@ package hallpointer.address.logic.parser; import static hallpointer.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static hallpointer.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static hallpointer.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static hallpointer.address.logic.parser.CliSyntax.PREFIX_NAME; -import static hallpointer.address.logic.parser.CliSyntax.PREFIX_PHONE; import static hallpointer.address.logic.parser.CliSyntax.PREFIX_REMARK; import static java.util.Objects.requireNonNull; @@ -39,4 +35,4 @@ public RemarkCommand parse(String args) throws ParseException { String remark = argMultimap.getValue(PREFIX_REMARK).orElse(""); return new RemarkCommand(index, new Remark(remark)); } -} \ No newline at end of file +} diff --git a/src/main/java/hallpointer/address/model/person/Remark.java b/src/main/java/hallpointer/address/model/person/Remark.java index 49d1a062863..229ed07016e 100644 --- a/src/main/java/hallpointer/address/model/person/Remark.java +++ b/src/main/java/hallpointer/address/model/person/Remark.java @@ -1,6 +1,5 @@ package hallpointer.address.model.person; -import static hallpointer.address.commons.util.AppUtil.checkArgument; import static java.util.Objects.requireNonNull; /** diff --git a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java index ca2dca6ae75..c3ea98cb406 100644 --- a/src/main/java/hallpointer/address/model/util/SampleDataUtil.java +++ b/src/main/java/hallpointer/address/model/util/SampleDataUtil.java @@ -24,23 +24,23 @@ public class SampleDataUtil { public static Person[] getSamplePersons() { return new Person[] { new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), EMPTY_REMARK - , getTagSet("friends")), + new Address("Blk 30 Geylang Street 29, #06-40"), EMPTY_REMARK, + getTagSet("friends")), new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), EMPTY_REMARK - , getTagSet("colleagues", "friends")), + new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), EMPTY_REMARK, + getTagSet("colleagues", "friends")), new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), EMPTY_REMARK - , getTagSet("neighbours")), + new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), EMPTY_REMARK, + getTagSet("neighbours")), new Person(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), EMPTY_REMARK - , getTagSet("family")), + new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), EMPTY_REMARK, + getTagSet("family")), new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new Address("Blk 47 Tampines Street 20, #17-35"), EMPTY_REMARK - , getTagSet("classmates")), + new Address("Blk 47 Tampines Street 20, #17-35"), EMPTY_REMARK, + getTagSet("classmates")), new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new Address("Blk 45 Aljunied Street 85, #11-31"), EMPTY_REMARK - , getTagSet("colleagues")) + new Address("Blk 45 Aljunied Street 85, #11-31"), EMPTY_REMARK, + getTagSet("colleagues")) }; } diff --git a/src/main/java/hallpointer/address/ui/PersonCard.java b/src/main/java/hallpointer/address/ui/PersonCard.java index 33c7dccffec..c482fec2d92 100644 --- a/src/main/java/hallpointer/address/ui/PersonCard.java +++ b/src/main/java/hallpointer/address/ui/PersonCard.java @@ -16,8 +16,7 @@ public class PersonCard extends UiPart { private static final String FXML = "PersonListCard.fxml"; - @FXML - private Label remark; + /** * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. @@ -42,6 +41,8 @@ public class PersonCard extends UiPart { @FXML private Label email; @FXML + private Label remark; + @FXML private FlowPane tags; /** diff --git a/src/test/java/hallpointer/address/logic/commands/RemarkCommandTest.java b/src/test/java/hallpointer/address/logic/commands/RemarkCommandTest.java index e893127fb96..6c7e94ae96f 100644 --- a/src/test/java/hallpointer/address/logic/commands/RemarkCommandTest.java +++ b/src/test/java/hallpointer/address/logic/commands/RemarkCommandTest.java @@ -29,8 +29,9 @@ */ public class RemarkCommandTest { - private Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs()); private static final String REMARK_STUB = "Some remark"; + private Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs()); + @Test public void execute() { @@ -120,4 +121,4 @@ public void equals() { assertFalse(standardCommand.equals(new RemarkCommand(INDEX_FIRST_PERSON, new Remark(VALID_REMARK_BOB)))); } -} \ No newline at end of file +} diff --git a/src/test/java/hallpointer/address/logic/parser/RemarkCommandParserTest.java b/src/test/java/hallpointer/address/logic/parser/RemarkCommandParserTest.java index 2896064b41a..595068703d6 100644 --- a/src/test/java/hallpointer/address/logic/parser/RemarkCommandParserTest.java +++ b/src/test/java/hallpointer/address/logic/parser/RemarkCommandParserTest.java @@ -24,7 +24,7 @@ public void parse_indexSpecified_success() { assertParseSuccess(parser, userInput, expectedCommand); // no remark userInput = targetIndex.getOneBased() + " " + PREFIX_REMARK; - expectedCommand = new RemarkCommand(INDEX_FIRST_PERSON, new Remark("")); + expectedCommand = new RemarkCommand(INDEX_FIRST_PERSON, new Remark("")); assertParseSuccess(parser, userInput, expectedCommand); } @Test diff --git a/src/test/java/hallpointer/address/storage/JsonAdaptedPersonTest.java b/src/test/java/hallpointer/address/storage/JsonAdaptedPersonTest.java index c795642b881..ad02d351fae 100644 --- a/src/test/java/hallpointer/address/storage/JsonAdaptedPersonTest.java +++ b/src/test/java/hallpointer/address/storage/JsonAdaptedPersonTest.java @@ -49,7 +49,8 @@ public void toModelType_invalidName_throwsIllegalValueException() { @Test public void toModelType_nullName_throwsIllegalValueException() { - JsonAdaptedPerson person = new JsonAdaptedPerson(null, VALID_PHONE, VALID_EMAIL, VALID_ADDRESS, VALID_REMARK, VALID_TAGS); + JsonAdaptedPerson person = new JsonAdaptedPerson(null, VALID_PHONE, VALID_EMAIL, + VALID_ADDRESS, VALID_REMARK, VALID_TAGS); String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()); assertThrows(IllegalValueException.class, expectedMessage, person::toModelType); } @@ -64,7 +65,8 @@ public void toModelType_invalidPhone_throwsIllegalValueException() { @Test public void toModelType_nullPhone_throwsIllegalValueException() { - JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, null, VALID_EMAIL, VALID_ADDRESS, VALID_REMARK, VALID_TAGS); + JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, null, VALID_EMAIL, VALID_ADDRESS, + VALID_REMARK, VALID_TAGS); String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Phone.class.getSimpleName()); assertThrows(IllegalValueException.class, expectedMessage, person::toModelType); } @@ -79,7 +81,8 @@ public void toModelType_invalidEmail_throwsIllegalValueException() { @Test public void toModelType_nullEmail_throwsIllegalValueException() { - JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, null, VALID_ADDRESS, VALID_REMARK, VALID_TAGS); + JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, null, VALID_ADDRESS, + VALID_REMARK, VALID_TAGS); String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Email.class.getSimpleName()); assertThrows(IllegalValueException.class, expectedMessage, person::toModelType); } @@ -94,7 +97,8 @@ public void toModelType_invalidAddress_throwsIllegalValueException() { @Test public void toModelType_nullAddress_throwsIllegalValueException() { - JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL, null, VALID_REMARK, VALID_TAGS); + JsonAdaptedPerson person = new JsonAdaptedPerson(VALID_NAME, VALID_PHONE, VALID_EMAIL, null, + VALID_REMARK, VALID_TAGS); String expectedMessage = String.format(MISSING_FIELD_MESSAGE_FORMAT, Address.class.getSimpleName()); assertThrows(IllegalValueException.class, expectedMessage, person::toModelType); }