-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#12641] Adding coverage to the isResponseOfFeedbackQuestionVisibleToStudent method #12641
Conversation
…dbackQuestionVisibleToStudent() method
Hi @TalesRG, thank you for your interest in contributing to TEAMMATES!
Please address the above before we proceed to review your PR. |
hey @TalesRG do ensure that the linting checks on github pass before we proceed to review this PR, thank you! |
} | ||
|
||
@Test | ||
public void testIsResponseOfFeedbackQuestionVisibleToStudentCT8(){ |
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.
let's rename the test cases to be more descriptive as well, following the convention testIsResponseOfFeedbackQuestionVisibleToStudent__, an example is above on line 1687 testGetSessionResultsForUser_orphanResponseInDB_shouldStillHandleCorrectly
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.
corrected test case descriptions
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.
apologies for missing this, do take a look at the new comments!
@@ -1712,6 +1712,116 @@ public void testGetSessionResultsForUser_orphanResponseInDB_shouldStillHandleCor | |||
assertEquals(4, responseForQuestion.size()); | |||
} | |||
|
|||
@Test | |||
public void testResponseVisibleToStudentWhenShownToStudents() { |
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.
the name for this test case should be testIsResponseOfFeedbackQuestionVisibleToStudent_showResponsesToStudent_shouldReturnTrue
do follow this format for the other test cases as well
public void testResponseVisibleToStudentWhenShownToOwnTeamMembers() { | ||
List<FeedbackParticipantType> showResponseTo = new ArrayList<>(); | ||
showResponseTo.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); | ||
|
||
FeedbackQuestionAttributes question = FeedbackQuestionAttributes.builder() | ||
.withShowResponsesTo(showResponseTo) | ||
.withRecipientType(FeedbackParticipantType.NONE) | ||
.withGiverType(FeedbackParticipantType.TEAMS) | ||
.build(); | ||
boolean response = FeedbackResponsesLogic.inst().isResponseOfFeedbackQuestionVisibleToStudent(question); | ||
assertEquals(response, true); | ||
} |
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 test case is a positive test case for
question.getGiverType() == FeedbackParticipantType.TEAMS
|| question.isResponseVisibleTo(FeedbackParticipantType.OWN_TEAM_MEMBERS, (lines 320 and 321 of FeedbackResponsesLogic)
given that it is an OR case, let's seperate the 2 conditions into their own test case
public void testResponseVisibleToStudentWhenReceiverIsGiver() { | ||
List<FeedbackParticipantType> showResponseTo = new ArrayList<>(); | ||
showResponseTo.add(FeedbackParticipantType.RECEIVER); | ||
|
||
FeedbackQuestionAttributes question = FeedbackQuestionAttributes.builder() | ||
.withShowResponsesTo(showResponseTo) | ||
.withRecipientType(FeedbackParticipantType.GIVER) | ||
.withGiverType(FeedbackParticipantType.STUDENTS) | ||
.build(); | ||
boolean response = FeedbackResponsesLogic.inst().isResponseOfFeedbackQuestionVisibleToStudent(question); | ||
assertEquals(response, true); | ||
} |
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.
let's add a test case where isStudentRecipientType is false but question.getRecipientType().isTeam() is true, and another where isStudentRecipientType is true, but question.isResponseVisibleTo(FeedbackParticipantType.RECEIVER) is false
Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢 |
hey @TalesRG, wondering if you're still working on this? |
Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢 |
Closing due to inactivity. Feel free to re-open if you want to continue working on this PR. |
Fixes [#12641]
Outline of Solution
This PR adds unit tests for method isResponseOfFeedbackQuestionVisibleToStudent from the FeedbackResponsesLogic class.
testResponseVisibleToStudentWhenShownToOwnTeamMembers
testResponseNotVisibleToStudentWhenReceiverTeamMembers
testResponseVisibleToStudentWhenReceiverIsGiver
testResponseVisibleToStudentWhenReceiverIsOwnTeamMember
testResponseVisibleToStudentInSameSection
testResponseVisibleToStudentWhenReceiverExcludesSelf
testResponseVisibleToStudentWhenReceiverIsStudent
testResponseVisibleToStudentWhenShownToStudents