diff --git a/src/main/java/seedu/address/logic/parser/EditCommandParser.java b/src/main/java/seedu/address/logic/parser/EditCommandParser.java index 6332eec05bf..517f1b5e671 100644 --- a/src/main/java/seedu/address/logic/parser/EditCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/EditCommandParser.java @@ -57,7 +57,6 @@ public EditCommand parse(String args) throws ParseException { if (argMultimap.getValue(PREFIX_DIFFICULTY).isPresent()) { editAnswerableDescriptor.setDifficulty(ParserUtil.parseDifficulty(argMultimap.getValue(PREFIX_DIFFICULTY).get())); } - parseCategoriesForEdit(argMultimap.getAllValues(PREFIX_CATEGORY)).ifPresent(editAnswerableDescriptor::setCategories); @@ -79,8 +78,7 @@ private Optional> parseCategoriesForEdit(Collection catego if (categories.isEmpty()) { return Optional.empty(); } - Collection categorySet = categories.size() == 1 && categories.contains("") ? Collections.emptySet() : categories; - return Optional.of(ParserUtil.parseCategories(categorySet)); + return Optional.of(ParserUtil.parseCategories(categories)); } } diff --git a/src/main/java/seedu/address/model/category/Category.java b/src/main/java/seedu/address/model/category/Category.java index 7c1edf6d986..9029b26da28 100644 --- a/src/main/java/seedu/address/model/category/Category.java +++ b/src/main/java/seedu/address/model/category/Category.java @@ -11,7 +11,6 @@ public class Category { public static final String MESSAGE_CONSTRAINTS = "Category names should not be blank"; public static final String VALIDATION_REGEX = "^(?=\\s*\\S).*$"; -// public static final String VALIDATION_REGEX = ".*"; public final String categoryName; diff --git a/src/main/java/seedu/address/storage/JsonAdaptedAnswerable.java b/src/main/java/seedu/address/storage/JsonAdaptedAnswerable.java index 61d4dfc2b39..46a922b030d 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedAnswerable.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedAnswerable.java @@ -62,7 +62,7 @@ public JsonAdaptedAnswerable(Answerable source) { correctAnswerSet.addAll(source.getCorrectAnswerSet().stream() .map(JsonAdaptedAnswer::new) .collect(Collectors.toList())); - wrongAnswerSet.addAll(source.getCorrectAnswerSet().stream() + wrongAnswerSet.addAll(source.getWrongAnswerSet().stream() .map(JsonAdaptedAnswer::new) .collect(Collectors.toList())); categories.addAll(source.getCategories().stream() diff --git a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java index 08123c9d19e..708bad99859 100644 --- a/src/test/java/seedu/address/logic/commands/CommandTestUtil.java +++ b/src/test/java/seedu/address/logic/commands/CommandTestUtil.java @@ -51,7 +51,7 @@ public class CommandTestUtil { public static final String CATEGORY_DESC_UML = " " + PREFIX_CATEGORY + VALID_CATEGORY_UML; public static final String CATEGORY_DESC_GREENFIELD = " " + PREFIX_CATEGORY + VALID_CATEGORY_GREENFIELD; - public static final String INVALID_QUESTION_DESC = " " + PREFIX_QUESTION + " "; // empty string not allowed for questions + public static final String INVALID_QUESTION_DESC = " " + PREFIX_QUESTION + ""; // empty string not allowed for questions public static final String INVALID_DIFFICULTY_DESC = " " + PREFIX_DIFFICULTY + "911a"; // 'a' not allowed in difficulty public static final String INVALID_CATEGORY_DESC = " " + PREFIX_CATEGORY + ""; // category cannot just be whitespace diff --git a/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java b/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java index 9ca23056202..4a1e4cf52c3 100644 --- a/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/EditCommandParserTest.java @@ -171,14 +171,4 @@ public void parse_invalidValueFollowedByValidValue_success() { assertParseSuccess(parser, userInput, expectedCommand); } - @Test - public void parse_resetTags_success() { - Index targetIndex = INDEX_THIRD_ANSWERABLE; - String userInput = targetIndex.getOneBased() + CATEGORY_EMPTY; - - EditAnswerableDescriptor descriptor = new EditAnswerableDescriptorBuilder().withCategories().build(); - EditCommand expectedCommand = new EditCommand(targetIndex, descriptor); - - assertParseSuccess(parser, userInput, expectedCommand); - } } diff --git a/src/test/java/seedu/address/storage/JsonAdaptedAnswerableTest.java b/src/test/java/seedu/address/storage/JsonAdaptedAnswerableTest.java index 846af6f6b7d..b8d1111e67a 100644 --- a/src/test/java/seedu/address/storage/JsonAdaptedAnswerableTest.java +++ b/src/test/java/seedu/address/storage/JsonAdaptedAnswerableTest.java @@ -34,8 +34,8 @@ public class JsonAdaptedAnswerableTest { @Test public void toModelType_validPersonDetails_returnsPerson() throws Exception { - JsonAdaptedAnswerable person = new JsonAdaptedAnswerable(B_ANSWERABLE); - assertEquals(B_ANSWERABLE, person.toModelType()); + JsonAdaptedAnswerable answerable = new JsonAdaptedAnswerable(B_ANSWERABLE); + assertEquals(B_ANSWERABLE, answerable.toModelType()); } @Test