Skip to content

test(licenses): add test coverage for LicenseHandler methods - Fixes #3736#3758

Open
ADITYA-CODE-SOURCE wants to merge 1 commit intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:fix/3736-license-handler-test-coverage
Open

test(licenses): add test coverage for LicenseHandler methods - Fixes #3736#3758
ADITYA-CODE-SOURCE wants to merge 1 commit intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:fix/3736-license-handler-test-coverage

Conversation

@ADITYA-CODE-SOURCE
Copy link
Contributor

Summary

This PR adds test coverage for LicenseHandler methods that previously had no tests, addressing issue #3736.

Changes Made

Added new test file LicenseHandlerAdditionalTest.java with comprehensive tests for:

  1. deleteLicense - Test deleting a license
  2. deleteLicenseNonAdmin - Test that non-admin cannot delete license
  3. addLicenseType - Test adding a new license type
  4. addLicenseTypeNonAdmin - Test that non-admin cannot add license type
  5. deleteLicenseType - Test deleting a license type
  6. getLicenseSummaryForExport - Test getting license summary
  7. getLicenseTypes - Test getting all license types
  8. deleteNonExistentLicense - Test deleting non-existent license
  9. deleteNonExistentLicenseType - Test deleting non-existent license type

Issue

This PR fixes #3736

Dependencies

No new dependencies added.

Suggest Reviewer

@GMishx @KoukiHama @ag4ums @arunazhakesan

How To Test?

The new tests can be run using:

mvn test -pl backend/licenses

All 9 new test cases should pass:

  • testDeleteLicense
  • testDeleteLicenseNonAdmin
  • testAddLicenseType
  • testAddLicenseTypeNonAdmin
  • testDeleteLicenseType
  • testGetLicenseSummaryForExport
  • testGetLicenseTypes
  • testDeleteNonExistentLicense
  • testDeleteNonExistentLicenseType

Checklist

Must:

Adds test coverage for the following methods that previously had no tests:
- testDeleteLicense: Test deleting a license
- testDeleteLicenseNonAdmin: Test that non-admin cannot delete license
- testAddLicenseType: Test adding a new license type
- testAddLicenseTypeNonAdmin: Test that non-admin cannot add license type
- testDeleteLicenseType: Test deleting a license type
- testGetLicenseSummaryForExport: Test getting license summary
- testGetLicenseTypes: Test getting all license types
- testDeleteNonExistentLicense: Test deleting non-existent license
- testDeleteNonExistentLicenseType: Test deleting non-existent license type

Fixes eclipse-sw360#3736
@ADITYA-CODE-SOURCE ADITYA-CODE-SOURCE force-pushed the fix/3736-license-handler-test-coverage branch from 37a6a6c to a204e8d Compare February 25, 2026 14:30
@ADITYA-CODE-SOURCE
Copy link
Contributor Author

Hello sir @GMishx,
I investigated the CI failure on PR #3758 and found that the build is also failing on the main branch with similar errors:

  1. CouchDB errors: database_does_not_exist ... _users database does not exist
  2. Thrift compilation errors: wrong number of type arguments; required 2
    This appears to be a project-wide infrastructure issue, not specific to my test file changes.
    My PR contains only:
  • New test file: LicenseHandlerAdditionalTest.java
  • 9 unit tests for LicenseHandler methods (deleteLicense, addLicenseType, etc.)
  • No changes to existing code or dependencies
    Could you please confirm if this is a known issue? Is there anything I can do to help resolve it?

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing test coverage for LicenseHandler business logic methods

2 participants