Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2872 update the AEM Mocks to 5.6.2 and made all tests working again #2875

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joerghoh
Copy link
Contributor

Q                       A
Fixed Issues? Fixes #2871
Patch: Bug Fix?
Minor: New Feature?
Major: Breaking Change?
Tests Added + Pass? Yes
Documentation Provided Yes (code comments and or markdown)
Any Dependency Changes?
License Apache License, Version 2.0

In order to make that update go I had to change testcases, as the MockExternalizer was changed (see https://wcm.io/testing/aem-mock/changes-report.html#a5.5.4).

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.15%. Comparing base (a517a37) to head (45c96b9).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2875   +/-   ##
=========================================
  Coverage     87.15%   87.15%           
  Complexity     2692     2692           
=========================================
  Files           235      235           
  Lines          7188     7188           
  Branches       1100     1100           
=========================================
  Hits           6265     6265           
  Misses          365      365           
  Partials        558      558           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Oct 11, 2024

class LinkImplTest {

private static final String URL = "/url.html";

private final AemContext context = CoreComponentTestContext.newAemContext();
Copy link
Member

@vladbailescu vladbailescu Oct 15, 2024

Choose a reason for hiding this comment

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

Could we avoid passing the context in all assertValidLinks? I see the context is instantiated here, maybe we can do that in LinkTestUtils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

assertValidLink is also used by other test classes; for example in LInkManagerTest I see that the context is also used in other ways. I haven't investigated if these tests would also work with 2 different instances of the AemContext, but I also don't think that it's worth the effort.

@@ -73,7 +73,7 @@ void testResourceExternalLink() {
context.currentResource(linkResource);
Link link = getUnderTest().get(linkResource).build();

assertValidLink(link, "http://myhost");
assertValidLink(link, "http://myhost",context);
Copy link
Member

Choose a reason for hiding this comment

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

Spacing is off here (and in other places too).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, fixed it.

@@ -117,7 +117,7 @@ void testVanityConfig() {
DefaultPathProcessor underTest = context.registerInjectActivateService(new DefaultPathProcessor(), ImmutableMap.of(
"vanityConfig", "shouldBeDefault"));
assertEquals("/content/site1/en.html", underTest.map(page.getPath() + HTML_EXTENSION, context.request()));
assertEquals("https://example.org/content/links/site1/en.html", underTest.externalize(page.getPath() + HTML_EXTENSION, context.request()));
assertEquals("https://example.org/content/site1/en.html", underTest.externalize(page.getPath() + HTML_EXTENSION, context.request()));
Copy link
Member

Choose a reason for hiding this comment

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

There's a missing /links which puzzles me, who is removing it and why? Is this a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is caused by a change in the AEM Mocks (wcm-io/io.wcm.testing.aem-mock#44), which has been added in AEM Mocks 5.5.4

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.

2 participants