Skip to content

Commit

Permalink
cosmetic: eliminate some code warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Jul 4, 2024
1 parent a170845 commit 1bfca04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* with rendering via dynamic media. The fallback to AEM-rendered renditions is disabled.
*/
@ExtendWith(AemContextExtension.class)
@SuppressWarnings("java:S5976") // ignore similar tests
@SuppressWarnings({ "java:S5976", "java:S4144" }) // ignore similar tests
class MediaHandlerImplImageFileTypesEnd2EndDynamicMediaNoFallbackTest extends MediaHandlerImplImageFileTypesEnd2EndTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public enum DummyAppTemplate {

// build resource type from template path
String resourceTypeFromPath = null;
final Pattern TEMPLATE_PATH_PATTERN = Pattern.compile("^/apps/([^/]+)/templates(/.*)?/([^/]+)$");
Matcher templateParts = TEMPLATE_PATH_PATTERN.matcher(templatePath);
final Pattern templatePathPattern = Pattern.compile("^/apps/([^/]+)/templates(/.*)?/([^/]+)$");
Matcher templateParts = templatePathPattern.matcher(templatePath);
if (templateParts.matches()) {
resourceTypeFromPath = templateParts.group(1) + "/components" + StringUtils.defaultString(templateParts.group(2))
+ "/page/" + templateParts.group(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,19 @@ void testIsMatchingSize_TooSmall_WidthDeviation() {

@Test
void testIsMatchingSize_MatchesExact_HeightDeviation() {
prepareSmartCropRendition(0, 0, 0.75, 0.5); // results in 80x75 cropping area, treated as 80x50
prepareSmartCropRendition(0, 0, 0.5, 0.75); // results in 80x75 cropping area, treated as 80x50
assertTrue(isMatchingSize(asset, context.resourceResolver(), dimension16_10, 80, 50));
}

@Test
void testIsMatchingSize_MatchesSmaller_HeightDeviation() {
prepareSmartCropRendition(0, 0, 0.75, 0.5); // results in 80x75 cropping area, treated as 80x50
prepareSmartCropRendition(0, 0, 0.5, 0.75); // results in 80x75 cropping area, treated as 80x50
assertTrue(isMatchingSize(asset, context.resourceResolver(), dimension16_10, 40, 25));
}

@Test
void testIsMatchingSize_TooSmall_HeightDeviation() {
prepareSmartCropRendition(0, 0, 0.75, 0.5); // results in 80x75 cropping area, treated as 80x50
prepareSmartCropRendition(0, 0, 0.5, 0.75); // results in 80x75 cropping area, treated as 80x50
assertFalse(isMatchingSize(asset, context.resourceResolver(), dimension16_10, 120, 75));
}

Expand Down

0 comments on commit 1bfca04

Please sign in to comment.