Skip to content

Conversation

@ds-vlisenco
Copy link

Description

chore: Add Unit Tests for the PolicyServiceImpl Class

This PR introduces comprehensive unit tests for the PolicyServiceImpl class in the Traceability backend. The class contains business logic for managing policies and interacts with PolicyRepository and EdcNotificationContractService.

The new tests improve code reliability and ensure correct interaction with the dependent components.


Changes

  • Added test class: PolicyServiceImplTest.java
  • Covered all public methods:
    • getIrsPolicies() (raw data map)
    • getPolicies() (flat list of PolicyResponse)
    • getPolicy(String id) (success + PolicyNotFoundException)
    • createPolicy(RegisterPolicyRequest) (creates policy, updates EDC)
    • updatePolicy(UpdatePolicyRequest) (updates policy, updates EDC)
    • deletePolicy(String id) (deletes policy, updates EDC)
  • Included tests for:
    • Success (happy path)
    • Error and edge cases (e.g. null, empty values, missing entries)
    • Interaction with dependencies (Mockito verify)
  • Ensured test coverage > 90%

Notes

  • No changes to business logic
  • Fully aligned with existing codebase and test standards
  • Existing test classes were used as reference

Related

[Add issue number or link if applicable]


Pre-review checks

  • ☑ DEPENDENCIES are up-to-date
  • ☑ Copyright and license header
  • ☑ Project coding standards adhered to

@ds-vlisenco ds-vlisenco changed the title Feature/unit-test-policy feature/unit-test-policy Jun 25, 2025
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