Skip to content

Commit

Permalink
fix all tests except list
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfredbtan committed Oct 17, 2019
1 parent c36735d commit 5000861
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -79,8 +78,7 @@ private Optional<Set<Category>> parseCategoriesForEdit(Collection<String> catego
if (categories.isEmpty()) {
return Optional.empty();
}
Collection<String> categorySet = categories.size() == 1 && categories.contains("") ? Collections.emptySet() : categories;
return Optional.of(ParserUtil.parseCategories(categorySet));
return Optional.of(ParserUtil.parseCategories(categories));
}

}
1 change: 0 additions & 1 deletion src/main/java/seedu/address/model/category/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5000861

Please sign in to comment.