Skip to content

Conversation

@Rockernun
Copy link

@Rockernun Rockernun commented Nov 11, 2025

Part of #13304

Outline of Solution
This PR refactors access-control unit tests to rely on the high-level and mid-level helper methods from BaseActionTest, reducing duplication and clarifying intent. I also split scenarios into narrowly scoped tests so each file exercises one behavior per test.

The refactored files are:

  • GetSessionResultsActionTest.java
  • GetStudentActionTest.java
  • GetStudentsActionTest.java

 

Notes for reviewers
Introduced focused stubbing utilities in GetStudentActionTest to ensure consistent entity ↔ course binding during self-lookup flows:

  • stubSelfLookupAsSameCourse(...)
  • stubSelfLookupAsOtherCourse(...)
  • regKeyParams(...)

Open to moving/renaming the new stubbing helpers to a shared location if preferred. If there are more appropriate BaseActionTest helpers I missed, I’m happy to switch over. Feedback on test naming and assertion granularity is welcome😄

…ub.com/Rockernun/teammates into test/refactor/sqlui-get-student-action-get-students-action
…ss tests

- Add stubSelfLookupAsSameCourse() and
stubSelfLookupAsOtherCourse()
- Each helper binds the login gid to student.account.googleId and sets
student.course appropriately
…ub.com/Rockernun/teammates into test/refactor/sqlui-get-student-action-get-students-action
- Rename test method names to satisfy Method name rule (remove extra underscores / confirm to pattern)
- Add trailing commas in array initializers to satisfy ArrayTrailingComma
- To satisfy PMD
- Keep its creation scoped to setUp as a local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant