MODLD-996: Add test to ensure that fingerprint rules exists for all resources generated#455
MODLD-996: Add test to ensure that fingerprint rules exists for all resources generated#455
Conversation
bfad935 to
b655d77
Compare
b655d77 to
995c873
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a test validator to ensure that all resources generated during tests have corresponding fingerprint rules defined. The implementation introduces a FingerprintRuleGraphValidator service that traverses resource graphs and verifies that each resource's type combination is covered by the fingerprint library configuration.
Changes:
- Added
FingerprintRuleGraphValidatortest service that validates resource type combinations against configured fingerprint rules - Integrated the validator into
ResourceControllerITBaseandPostResourceITtest classes to automatically verify fingerprint rules - Added exclusion mechanism for type combinations that don't require fingerprint rules (e.g., SUPPLEMENTARY_CONTENT, FREQUENCY)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| FingerprintRuleGraphValidator.java | New test service that validates fingerprint rules exist for all resources in a graph, with support for excluded type combinations |
| ResourceControllerITBase.java | Integrated validator into instance and work creation tests with exclusions for SUPPLEMENTARY_CONTENT |
| PostResourceIT.java | Added abstract method to allow test subclasses to specify excluded type combinations and integrated validator into test flow |
| PublicationFrequencyIT.java | Overrides exclusion method to exclude FREQUENCY type from validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| protected abstract void validateGraph(Resource resource); | ||
|
|
||
| protected Set<Set<String>> excludedFingerintValidationTypes() { |
There was a problem hiding this comment.
Typo in method name: "Fingerint" should be "Fingerprint".
| public class PublicationFrequencyIT extends PostResourceIT { | ||
|
|
||
| @Override | ||
| protected Set<Set<String>> excludedFingerintValidationTypes() { |
There was a problem hiding this comment.
Typo in method name: "Fingerint" should be "Fingerprint". This method overrides the parent class method and should match its corrected spelling.
| protected Set<Set<String>> excludedFingerintValidationTypes() { | |
| protected Set<Set<String>> excludedFingerprintValidationTypes() { |
| validateApiResponse(postResponse); | ||
| var resourceId = getResourceId(postResponse); | ||
| var resource = resourceService.getResourceById(resourceId, RESOURCE_FETCH_DEPTH); | ||
| fingerprintRuleGraphValidator.validateFingerprintRuleExists(resource, excludedFingerintValidationTypes()); |
There was a problem hiding this comment.
Typo in method call: "Fingerint" should be "Fingerprint". This should call the corrected method name.
…esources generated
995c873 to
6e78886
Compare
|
PBobylev
left a comment
There was a problem hiding this comment.
I think we violate lib-linked-data-fingerprint library's single responsibility.
- It's responsibility to manage fignerprint rules, the list of types which should have exact rule and corresponding test coverage.
- When SRP is broken it's always required to change multiple things instead of one: when we will add a new rule for a resource type, we will have to add it to 3 libs: lib-linked-data-fingerprint + lib-linked-data-marc4ld + lib-linked-data-rdf4ld.



No description provided.