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
[#9119] FeedbackResponseCommentsLogicTest: Fix verification for test #9280
Conversation
b7030aa
to
20833c8
Compare
@@ -85,19 +85,22 @@ public void testCreateFeedbackResponseComment() throws Exception { | |||
verifyPresentInDatastore(frComment); | |||
|
|||
______TS("typical successful case: frComment already exists"); |
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.
Describe the behaviour when frComment already exists.
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.
okay will do
@@ -85,19 +85,22 @@ public void testCreateFeedbackResponseComment() throws Exception { | |||
verifyPresentInDatastore(frComment); | |||
|
|||
______TS("typical successful case: frComment already exists"); | |||
|
|||
FeedbackResponseCommentAttributes actualComment = |
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.
I believe you are trying to verify that the comment exist in the database before the test.
assertNotNull(frcLogic.getFeedbackResponseComment(frComment.getId()))
The above can already do the job?
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.
No, this is to fetch the existing comment from the database. I use this to verify that the duplicate comment has the same ID as the existing one.
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.
Then put it together with L97.
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.
L97? That would defeat the purpose, since after this I create a duplicate feedback response comment in the database. The variable frcomment
will then be assigned the id.
If I fetch frcomment
from the database following that, it would always pass. I need to be able to fetch the original comment and verify that its ID is the same as the one given to frcomment
Unless, there is a better way to do this.
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.
since after this I create a duplicate feedback response comment in the database.
Wait, we are not creating duplicate feedback response right? If the id is the same, the creation will become update.
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.
Updated the documentation! Do see if its more clear now
break; | ||
} | ||
} | ||
// check that it uses existing ID from database |
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.
I get what u mean finally. You are trying to verify that the ID has been set by the createFeedbackResponseComment
. 👍 (You may want to comment it here.)
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.
okay will update the comment 👍
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.
BTW, will the test fail if you remove the .setId() in createFeedbackResponseComment
(i.e. make sure frComment
has empty id before the test).
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.
Yup it will fail: the .getId()
method will return null
and an exception will be thrown.
This is the current behaviour of the test even before the PR. The deleteFeedbackResponseCommentById
method in the cleanup portion relies on the ID being set.
20833c8
to
4a930c3
Compare
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.
LGTM!
…for test (TEAMMATES#9280) [TEAMMATES#9119] FeedbackResponseCommentsLogicTest: Fix verification for test (TEAMMATES#9280)
Fixes #9119
The initial testing code did not verify the case where a duplicate comment is added.
When a duplicate comment is added, the expected behaviour is:
As such, in the test, I do a verification of whether the ID has been set correctly. I also change the
commentText
and check if the update works.