Skip to content

Commit

Permalink
Added tests to cover missing dc:format cases
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgonzalez committed Jul 22, 2024
1 parent eb9854c commit 64747ab
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,26 @@ public void testAccepts_False() throws Exception {

assertFalse("OFT should not be accepted", dispatcher.accepts(assetModel, "test"));
}


@Test
public void testAccepts_NoDcFormat_False() {
ctx.currentResource("/content/dam/test.no-dc-format");
AssetModel assetModel = ctx.request().adaptTo(AssetModel.class);

AssetRenditionDispatcher dispatcher = ctx.getService(AssetRenditionDispatcher.class);

assertFalse("Missing dc:format should not be accepted", dispatcher.accepts(assetModel, "test"));
}


@Test
public void testAccepts_BlankDcFormat_False() {
ctx.currentResource("/content/dam/test.blank-dc-format");
AssetModel assetModel = ctx.request().adaptTo(AssetModel.class);

AssetRenditionDispatcher dispatcher = ctx.getService(AssetRenditionDispatcher.class);

assertFalse("Blank dc:format should not be accepted", dispatcher.accepts(assetModel, "test"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,45 @@
}
}
}
},
"test.no-dc-format": {
"jcr:primaryType": "dam:Asset",
"jcr:content": {
"jcr:primaryType": "nt:unstructured",
"metadata": {
"jcr:primaryType": "nt:unstructured"
},
"renditions": {
"jcr:primaryType": "nt:unstructured",
"cq5dam.web.1280.1280.png": {
"jcr:primaryType": "nt:file",
"jcr:content": {
"jcr:primaryType": "oak:Resource",
"jcr:mimeType": "image/png"
}
}
}
}
},
"test.blank-dc-format": {
"jcr:primaryType": "dam:Asset",
"jcr:content": {
"jcr:primaryType": "nt:unstructured",
"metadata": {
"jcr:primaryType": "nt:unstructured",
"dc:format": " "
},
"renditions": {
"jcr:primaryType": "nt:unstructured",
"cq5dam.web.1280.1280.png": {
"jcr:primaryType": "nt:file",
"jcr:content": {
"jcr:primaryType": "oak:Resource",
"jcr:mimeType": "image/png"
}
}
}
}
}
}
}

0 comments on commit 64747ab

Please sign in to comment.