Skip to content

MODLD-996: Add test to ensure that fingerprint rules exists for all resources generated#455

Open
pkjacob wants to merge 1 commit intomasterfrom
pjacob/MODLD-996
Open

MODLD-996: Add test to ensure that fingerprint rules exists for all resources generated#455
pkjacob wants to merge 1 commit intomasterfrom
pjacob/MODLD-996

Conversation

@pkjacob
Copy link
Contributor

@pkjacob pkjacob commented Feb 23, 2026

No description provided.

Base automatically changed from pjacob/MODLD-980_2 to master February 23, 2026 20:35
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 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 FingerprintRuleGraphValidator test service that validates resource type combinations against configured fingerprint rules
  • Integrated the validator into ResourceControllerITBase and PostResourceIT test 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() {
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

Typo in method name: "Fingerint" should be "Fingerprint".

Copilot uses AI. Check for mistakes.
public class PublicationFrequencyIT extends PostResourceIT {

@Override
protected Set<Set<String>> excludedFingerintValidationTypes() {
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

Typo in method name: "Fingerint" should be "Fingerprint". This method overrides the parent class method and should match its corrected spelling.

Suggested change
protected Set<Set<String>> excludedFingerintValidationTypes() {
protected Set<Set<String>> excludedFingerprintValidationTypes() {

Copilot uses AI. Check for mistakes.
validateApiResponse(postResponse);
var resourceId = getResourceId(postResponse);
var resource = resourceService.getResourceById(resourceId, RESOURCE_FETCH_DEPTH);
fingerprintRuleGraphValidator.validateFingerprintRuleExists(resource, excludedFingerintValidationTypes());
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

Typo in method call: "Fingerint" should be "Fingerprint". This should call the corrected method name.

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

Copy link
Contributor

@PBobylev PBobylev left a comment

Choose a reason for hiding this comment

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

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.

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.

3 participants