Skip to content
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

Closed
wants to merge 8 commits into from

Conversation

TalesRG
Copy link

@TalesRG TalesRG commented Nov 22, 2023

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

Copy link

Hi @TalesRG, thank you for your interest in contributing to TEAMMATES!
However, your PR does not appear to follow our contribution guidelines:

  • Description must reference the issue number the PR is fixing, e.g. Fixes #<issue-number> (or Part of #<issue-number> if the PR does not address the issue fully)

Please address the above before we proceed to review your PR.

@TalesRG TalesRG changed the title [#1502] Adding coverage to the isResponseOfFeedbackQuestionVisibleToStudent method [#12641] Adding coverage to the isResponseOfFeedbackQuestionVisibleToStudent method Nov 22, 2023
@cedricongjh
Copy link
Contributor

hey @TalesRG do ensure that the linting checks on github pass before we proceed to review this PR, thank you!

}

@Test
public void testIsResponseOfFeedbackQuestionVisibleToStudentCT8(){
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected test case descriptions

@cedricongjh cedricongjh self-assigned this Nov 22, 2023
@cedricongjh cedricongjh added the s.ToReview The PR is waiting for review(s) label Nov 22, 2023
@cedricongjh cedricongjh self-requested a review November 30, 2023 19:15
Copy link
Contributor

@cedricongjh cedricongjh left a 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() {
Copy link
Contributor

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

Comment on lines +1812 to +1823
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);
}
Copy link
Contributor

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

Comment on lines +1784 to +1795
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);
}
Copy link
Contributor

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

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@cedricongjh
Copy link
Contributor

hey @TalesRG, wondering if you're still working on this?

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@weiquu
Copy link
Contributor

weiquu commented Dec 18, 2023

Closing due to inactivity. Feel free to re-open if you want to continue working on this PR.

@weiquu weiquu closed this Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s.ToReview The PR is waiting for review(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants