-
Notifications
You must be signed in to change notification settings - Fork 754
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a missing There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
context.request().setContextPath("/cp"); | ||
underTest = context.registerInjectActivateService(new DefaultPathProcessor(), ImmutableMap.of( | ||
"vanityConfig", DefaultPathProcessor.VanityConfig.ALWAYS.getValue())); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,25 +19,32 @@ | |
|
||
import com.adobe.cq.wcm.core.components.context.CoreComponentTestContext; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import com.adobe.cq.wcm.core.components.commons.link.Link; | ||
import com.day.cq.wcm.api.Page; | ||
import com.google.common.collect.ImmutableMap; | ||
|
||
import io.wcm.testing.mock.aem.junit5.AemContext; | ||
import io.wcm.testing.mock.aem.junit5.AemContextExtension; | ||
|
||
import static com.adobe.cq.wcm.core.components.internal.link.LinkImpl.*; | ||
import static com.adobe.cq.wcm.core.components.internal.link.LinkTestUtils.assertInvalidLink; | ||
import static com.adobe.cq.wcm.core.components.internal.link.LinkTestUtils.assertValidLink; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@ExtendWith(AemContextExtension.class) | ||
class LinkImplTest { | ||
|
||
private static final String URL = "/url.html"; | ||
|
||
private final AemContext context = CoreComponentTestContext.newAemContext(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we avoid passing the context in all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
@Test | ||
void testValidLink() { | ||
Link<Page> link = new LinkImpl<>(URL, URL, CoreComponentTestContext.EXTERNALIZER_PUBLISH_DOMAIN + URL, null, null); | ||
assertValidLink(link, URL); | ||
assertValidLink(link, URL, context); | ||
assertNull(link.getReference()); | ||
assertEquals(URL, link.getMappedURL()); | ||
} | ||
|
@@ -46,15 +53,15 @@ void testValidLink() { | |
void testValidLinkWithTarget() { | ||
Link<Page> link = new LinkImpl(URL, URL, CoreComponentTestContext.EXTERNALIZER_PUBLISH_DOMAIN + URL, null, | ||
new HashMap<String, String>() {{ put(ATTR_TARGET, "_blank"); }}); | ||
assertValidLink(link, URL, "_blank"); | ||
assertValidLink(link, URL, "_blank", context); | ||
assertNull(link.getReference()); | ||
} | ||
|
||
@Test | ||
void testValidLinkWithoutTarget() { | ||
Link link = new LinkImpl(URL, URL, CoreComponentTestContext.EXTERNALIZER_PUBLISH_DOMAIN + URL,null, null); | ||
|
||
assertValidLink(link, URL, (String)null); | ||
assertValidLink(link, URL, (String)null, context); | ||
assertNull(link.getReference()); | ||
} | ||
|
||
|
@@ -64,7 +71,7 @@ void testValidLinkWithTargetAndTargetPage() { | |
Link<Page> link = new LinkImpl<>(URL, URL, CoreComponentTestContext.EXTERNALIZER_PUBLISH_DOMAIN + URL, page, | ||
new HashMap<String, String>() {{ put(ATTR_TARGET, | ||
"_blank"); }}); | ||
assertValidLink(link, URL, "_blank"); | ||
assertValidLink(link, URL, "_blank", context); | ||
assertSame(page, link.getReference()); | ||
} | ||
|
||
|
@@ -107,7 +114,7 @@ void testValidLikWithFilteredHtmlAttributes() { | |
String invalidAttribute = "invalidAttribute"; | ||
Link<Page> link = new LinkImpl<>(URL, URL, CoreComponentTestContext.EXTERNALIZER_PUBLISH_DOMAIN + URL, page, ImmutableMap.of(invalidAttribute, | ||
"invalidValue")); | ||
assertValidLink(link, URL); | ||
assertValidLink(link, URL,context); | ||
assertNull(link.getHtmlAttributes().get(invalidAttribute)); | ||
} | ||
} |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, fixed it.