-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Phone and Email instances, refactor TypicalQAndA #71
Conversation
Refactor typical question set.
* refactor-phone-email: Delete phone and email instances. Refactor typical question set. # Conflicts: # src/main/java/seedu/medmoriser/logic/commands/AddCommand.java # src/main/java/seedu/medmoriser/logic/commands/EditCommand.java # src/main/java/seedu/medmoriser/logic/parser/EditCommandParser.java # src/main/java/seedu/medmoriser/storage/JsonAdaptedQAndA.java # src/test/data/JsonSerializableMedmoriserTest/duplicateQAndAMedmoriser.json # src/test/data/JsonSerializableMedmoriserTest/invalidQAndAMedmoriser.json # src/test/data/JsonSerializableMedmoriserTest/typicalQAndAsMedmoriser.json # src/test/java/seedu/medmoriser/logic/LogicManagerTest.java # src/test/java/seedu/medmoriser/logic/commands/CommandTestUtil.java # src/test/java/seedu/medmoriser/logic/commands/EditCommandTest.java # src/test/java/seedu/medmoriser/logic/commands/EditQAndADescriptorTest.java # src/test/java/seedu/medmoriser/logic/commands/FindCommandTest.java # src/test/java/seedu/medmoriser/logic/parser/AddCommandParserTest.java # src/test/java/seedu/medmoriser/logic/parser/EditCommandParserTest.java # src/test/java/seedu/medmoriser/logic/parser/ParserUtilTest.java # src/test/java/seedu/medmoriser/model/MedmoriserTest.java # src/test/java/seedu/medmoriser/model/ModelManagerTest.java # src/test/java/seedu/medmoriser/model/qanda/AnswerContainsKeywordPredicateTest.java # src/test/java/seedu/medmoriser/model/qanda/QAndATest.java # src/test/java/seedu/medmoriser/model/qanda/QuestionContainsKeywordsPredicateTest.java # src/test/java/seedu/medmoriser/model/qanda/UniqueQAndAListTest.java # src/test/java/seedu/medmoriser/storage/JsonAdaptedQAndATest.java # src/test/java/seedu/medmoriser/storage/JsonMedmoriserStorageTest.java # src/test/java/seedu/medmoriser/testutil/EditQuestionSetDescriptorBuilder.java # src/test/java/seedu/medmoriser/testutil/QAndABuilder.java # src/test/java/seedu/medmoriser/testutil/TypicalQAndA.java
QAndABuilder qAndAInList = new QAndABuilder(lastQAndA); | ||
QAndA editedQAndA = qAndAInList.withQuestion(VALID_QUESTION_BOB).withPhone(VALID_PHONE_BOB) | ||
.withTags(VALID_TAG_HUSBAND).build(); | ||
QAndABuilder questionSetInList = new QAndABuilder(lastQAndA); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you edited the qAndAInList back to questionSetInList
QAndA editedQAndA = qAndAInList.withQuestion(VALID_QUESTION_BOB).withPhone(VALID_PHONE_BOB) | ||
.withTags(VALID_TAG_HUSBAND).build(); | ||
QAndABuilder questionSetInList = new QAndABuilder(lastQAndA); | ||
QAndA editedQAndA = questionSetInList.withQuestion(VALID_QUESTION_B).withTags(VALID_TAG_TAG2).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSetInList
public void resetData_withDuplicateQAndAs_throwsDuplicateQAndAException() { | ||
// Two qAndAs with the same identity fields | ||
QAndA editedAlice = new QAndABuilder(ALICE).withAnswer(VALID_ANSWER_BOB).withTags(VALID_TAG_HUSBAND) | ||
public void resetData_withDuplicateQuestionSets_throwsDuplicateQuestionSetException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
// Two qAndAs with the same identity fields | ||
QAndA editedAlice = new QAndABuilder(ALICE).withAnswer(VALID_ANSWER_BOB).withTags(VALID_TAG_HUSBAND) | ||
public void resetData_withDuplicateQuestionSets_throwsDuplicateQuestionSetException() { | ||
// Two questionSets with the same identity fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
@@ -60,22 +59,22 @@ public void hasQAndA_nullQAndA_throwsNullPointerException() { | |||
} | |||
|
|||
@Test | |||
public void hasQAndA_qAndANotInMedmoriser_returnsFalse() { | |||
assertFalse(medmoriser.hasQAndA(ALICE)); | |||
public void hasQAndA_questionSetNotInMedmoriser_returnsFalse() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
public void hasQAndA_qAndAInMedmoriser_returnsTrue() { | ||
medmoriser.addQAndA(ALICE); | ||
assertTrue(medmoriser.hasQAndA(ALICE)); | ||
public void hasQuestionSet_questionSetInMedmoriser_returnsTrue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
public void hasQAndA_qAndAWithSameIdentityFieldsInMedmoriser_returnsTrue() { | ||
medmoriser.addQAndA(ALICE); | ||
QAndA editedAlice = new QAndABuilder(ALICE).withAnswer(VALID_ANSWER_BOB).withTags(VALID_TAG_HUSBAND) | ||
public void hasQuestionSet_questionSetWithSameIdentityFieldsInMedmoriser_returnsTrue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
@@ -78,14 +78,14 @@ public void hasQAndA_nullQAndA_throwsNullPointerException() { | |||
} | |||
|
|||
@Test | |||
public void hasQAndA_qAndANotInMedmoriser_returnsFalse() { | |||
assertFalse(modelManager.hasQAndA(ALICE)); | |||
public void hasQAndA_questionSetNotInMedmoriser_returnsFalse() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
public void hasQAndA_qAndAInMedmoriser_returnsTrue() { | ||
modelManager.addQAndA(ALICE); | ||
assertTrue(modelManager.hasQAndA(ALICE)); | ||
public void hasQuestionSet_questionSetInMedmoriser_returnsTrue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
uniqueQAndAList.add(ALICE); | ||
uniqueQAndAList.add(BOB); | ||
assertThrows(DuplicateQAndAException.class, () -> uniqueQAndAList.setQAndA(ALICE, BOB)); | ||
public void setQAndA_editedQuestionSetHasNonUniqueIdentity_throwsDuplicateQuestionSetException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
public void remove_existingQAndA_removesQAndA() { | ||
uniqueQAndAList.add(ALICE); | ||
uniqueQAndAList.remove(ALICE); | ||
public void remove_existingQuestionSet_removesQAndA() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
assertEquals(expectedUniqueQAndAList, uniqueQAndAList); | ||
} | ||
|
||
@Test | ||
public void setQAndAs_listWithDuplicateQuestions_throwsDuplicateQAndAException() { | ||
List<QAndA> listWithDuplicateQAndAs = Arrays.asList(ALICE, ALICE); | ||
public void setQAndAs_listWithDuplicateQuestions_throwsDuplicateQuestionSetException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet back to qAndA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just need to change some instances of questionSets back to qAndA, otherwise its good to go!
public void resetData_withDuplicateQAndAs_throwsDuplicateQAndAException() { | ||
// Two qAndAs with the same identity fields | ||
QAndA editedAlice = new QAndABuilder(ALICE).withAnswer(VALID_ANSWER_BOB).withTags(VALID_TAG_HUSBAND) | ||
public void resetData_withDuplicateQuestionSets_throwsDuplicateQAndAException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSet
public void hasQAndA_qAndAInMedmoriser_returnsTrue() { | ||
modelManager.addQAndA(ALICE); | ||
assertTrue(modelManager.hasQAndA(ALICE)); | ||
public void hasQuestionSet_qAndAInMedmoriser_returnsTrue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSet
public void setQAndA_editedQAndAHasDifferentIdentity_success() { | ||
uniqueQAndAList.add(ALICE); | ||
uniqueQAndAList.setQAndA(ALICE, BOB); | ||
public void setQAndA_editedQuestionSetHasDifferentIdentity_success() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSet
uniqueQAndAList.add(ALICE); | ||
uniqueQAndAList.add(BOB); | ||
assertThrows(DuplicateQAndAException.class, () -> uniqueQAndAList.setQAndA(ALICE, BOB)); | ||
public void setQAndA_editedQAndAHasNonUniqueIdentity_throwsDuplicateQuestionSetException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change questionSet
public void remove_qAndADoesNotExist_throwsQAndANotFoundException() { | ||
assertThrows(QAndANotFoundException.class, () -> uniqueQAndAList.remove(ALICE)); | ||
|
||
public void remove_qAndADoesNotExist_throwsQuestionSetNotFoundException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionSet
"tagged" : [ "friends" ] | ||
"question" : "Question One", | ||
"answer" : "Answer 1", | ||
"tagged" : [ "DNA" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can have 1 or two showing the phrase version instead of 1 word, but no biggie
Codecov Report
@@ Coverage Diff @@
## master #71 +/- ##
============================================
- Coverage 68.15% 67.42% -0.74%
+ Complexity 445 419 -26
============================================
Files 79 77 -2
Lines 1410 1326 -84
Branches 150 135 -15
============================================
- Hits 961 894 -67
+ Misses 404 390 -14
+ Partials 45 42 -3
Continue to review full report at Codecov.
|
|
||
// different qAndA -> returns false | ||
assertFalse(ALICE.equals(BOB)); | ||
// different questionSet -> returns false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to refer to this as QAndA?
public static final QAndA BOB = new QAndABuilder().withQuestion(VALID_QUESTION_BOB) | ||
.withPhone(VALID_PHONE_BOB).withEmail(VALID_EMAIL_BOB).withAnswer(VALID_ANSWER_BOB) | ||
.withTags(VALID_TAG_HUSBAND, VALID_TAG_FRIEND).build(); | ||
// Manually added - QuestionSet's details found in {@code CommandTestUtil} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too, just to make it less confusing for readers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than some name changes, I think it's good to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job brother
No description provided.