Unittest für PolicyServiceImpl.java #1472
Closed
ds-vlisenco wants to merge 10 commits intoeclipse-tractusx:mainfrom
Closed
Unittest für PolicyServiceImpl.java #1472ds-vlisenco wants to merge 10 commits intoeclipse-tractusx:mainfrom
ds-vlisenco wants to merge 10 commits intoeclipse-tractusx:mainfrom
Conversation
…eature/policy-unit-test
Added input validation to PolicyServiceImpl#getPolicy to throw IllegalArgumentException when policy ID is null or blank. This ensures consistent error handling and aligns with unit test expectations. Also resolves failing test cases in PolicyServiceImplTest that check for invalid inputs.
Added input validation to PolicyServiceImpl#getPolicy to throw IllegalArgumentException when policy ID is null or blank. This ensures consistent error handling and aligns with unit test expectations. Also resolves failing test cases in PolicyServiceImplTest that check for invalid inputs.
…eature/policy-unit-test
feature/policy-unit-test
fix: add null checks to PolicyServiceImpl to handle invalid input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
feat: Add unit tests for PolicyServiceImpl class
Dieses PR führt umfassende Unit Tests für die Klasse
PolicyServiceImplim Traceability-Backend ein. Die Klasse enthält Geschäftslogik zur Verwaltung von Policies und interagiert mitPolicyRepositoryundEdcNotificationContractService.Die neuen Tests verbessern die Zuverlässigkeit des Codes und stellen die korrekte Interaktion mit den abhängigen Komponenten sicher.
Fixes: [gegebenenfalls Issue-Nummer eintragen]
Pre-review checks
Bitte sicherstellen, dass folgende Punkte erfüllt sind:
Hintergrund
Die Klasse
PolicyServiceImplhatte bislang keine dedizierten Unit Tests. Ziel ist es, deren Korrektheit und Wartbarkeit durch vollständige Testabdeckung aller öffentlichen Methoden sicherzustellen.Umfang
Folgende Methoden wurden getestet:
getIrsPolicies(): Rückgabe der Rohdaten-MapgetPolicies(): Rückgabe einer flachen Liste vonPolicyResponsegetPolicy(String id): Erfolg und Fehlerfall (PolicyNotFoundException)createPolicy(RegisterPolicyRequest): Erstellung und EDC-AktualisierungupdatePolicy(UpdatePolicyRequest): Update und EDC-AktualisierungdeletePolicy(String id): Löschung und EDC-AktualisierungAbgedeckte Szenarien:
verify)Teststrategie
PolicyServiceImplTest.java@ExtendWith(MockitoExtension.class)assertThrows(...)verify(...)Akzeptanzkriterien
PolicyServiceImplTest.javawurde erstelltHinweise