Skip to content

fix(#11963): Migrate StudyViewControllerTest to JUnit 5 and fix ignored tests #11964

Open
purvanshjoshi wants to merge 4 commits intocBioPortal:masterfrom
purvanshjoshi:fix/issue-11963-studyviewcontroller-junit5
Open

fix(#11963): Migrate StudyViewControllerTest to JUnit 5 and fix ignored tests #11964
purvanshjoshi wants to merge 4 commits intocBioPortal:masterfrom
purvanshjoshi:fix/issue-11963-studyviewcontroller-junit5

Conversation

@purvanshjoshi
Copy link

@purvanshjoshi purvanshjoshi commented Feb 14, 2026

Fix #11963

Describe changes proposed in this pull request:

  • Migrated StudyViewControllerTest.java from JUnit 4 to JUnit 5, updating annotations (@ExtendWith, @BeforeEach, @Disabled) and imports.
  • Fixed and enabled fetchClinicalDataBinCounts test:
    • Replaced mocked ClinicalDataBinUtil and ClinicalDataFetcher with real bean instances to verify actual binning logic.
    • Added IdPopulator to the test context to support the real ClinicalDataBinUtil.
    • Mocked CustomDataService to resolve dependency issues.
  • Fixed and enabled fetchClinicalDataDensityPlot test:
    • Updated test assertions to match the API's sparse response format (verifying only populated bins instead of expecting a dense matrix).
    • Resolved a 403 Forbidden error by adding .with(csrf()) to the mock request builder.
  • Verified all 19 tests in StudyViewControllerTest pass successfully.

Checks

Notify reviewers

Read our Pull request merging
policy
. It can help to figure out who worked on the
file before you. Please use git blame <filename> to determine that
and notify them either through slack or by assigning them as a reviewer on the PR

Copilot AI review requested due to automatic review settings February 14, 2026 16:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates StudyViewControllerTest from JUnit 4 to JUnit 5 and fixes two previously ignored tests (fetchClinicalDataBinCounts and fetchClinicalDataDensityPlot) that were failing due to incorrect mocking strategies and outdated assertions.

Changes:

  • Migrated test class from JUnit 4 to JUnit 5 by updating annotations and imports
  • Fixed fetchClinicalDataBinCounts test by replacing mocked ClinicalDataBinUtil and ClinicalDataFetcher with real bean instances, and adding required dependencies (IdPopulator, CustomDataService)
  • Fixed fetchClinicalDataDensityPlot test by updating assertions to match the API's sparse response format (which filters out empty bins) and adding CSRF token to resolve 403 Forbidden error

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dippindots dippindots self-requested a review February 17, 2026 16:14
@dippindots dippindots self-assigned this Feb 17, 2026
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.

Migrate StudyViewControllerTest to JUnit 5 and Fix Ignored Tests

2 participants