Created
June 11, 2020 01:55
-
-
Save dfparker2002/b5e48ed62ec29849297b52e0ede9af60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src: https://github.com/adobe/aem-core-wcm-components/blob/164f8ba575d7b7db080008cea5032209d9857d34/testing/junit/core/src/main/java/com/adobe/cq/wcm/core/components/testing/MockExternalizerFactory.java | |
package com.adobe.cq.wcm.core.components.testing; | |
import org.apache.sling.api.resource.ResourceResolver; | |
import com.day.cq.commons.Externalizer; | |
import static org.mockito.ArgumentMatchers.any; | |
import static org.mockito.ArgumentMatchers.anyString; | |
import static org.mockito.Mockito.mock; | |
import static org.mockito.Mockito.when; | |
public class MockExternalizerFactory { | |
public static final String ROOT = "https://example.org"; | |
public static Externalizer getExternalizerService() { | |
Externalizer externalizer = mock(Externalizer.class); | |
when(externalizer.publishLink(any(ResourceResolver.class), anyString())).then( | |
invocationOnMock -> ROOT + invocationOnMock.getArgument(1)); | |
return externalizer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
support lib
org.apache.sling
org.apache.sling.testing.resourceresolver-mock
1.1.22