use of org.apache.sling.api.resource.ResourceWrapper in project sling by apache.
the class ResourceResolverWrapperTest method testResolve2.
@SuppressWarnings("deprecation")
@Test
public void testResolve2() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class);
final Resource resource = mock(Resource.class);
when(resource.getPath()).thenReturn(PATH);
when(wrappedResolver.resolve(request)).thenReturn(resource);
final Resource result = underTest.resolve(request);
assertTrue(result instanceof ResourceWrapper);
assertEquals(underTest, result.getResourceResolver());
assertEquals(resource.getPath(), result.getPath());
verify(wrappedResolver).resolve(request);
}
use of org.apache.sling.api.resource.ResourceWrapper in project sling by apache.
the class ResourceResolverWrapperTest method testGetParent.
@Test
public void testGetParent() throws Exception {
final Resource parent = mock(Resource.class);
final Resource child = mock(Resource.class);
when(parent.getPath()).thenReturn(PATH);
when(wrappedResolver.getParent(child)).thenReturn(parent);
Resource result = underTest.getParent(child);
assertTrue(result instanceof ResourceWrapper);
assertEquals(parent.getPath(), result.getPath());
verify(wrappedResolver).getParent(child);
}
use of org.apache.sling.api.resource.ResourceWrapper in project sling by apache.
the class ResourceResolverWrapperTest method testCopy.
@Test
public void testCopy() throws Exception {
final String source = "source";
final String destination = "destination";
final Resource expected = mock(Resource.class);
when(expected.getPath()).thenReturn(destination);
when(wrappedResolver.copy(source, destination)).thenReturn(expected);
final Resource result = underTest.copy(source, destination);
assertTrue(result instanceof ResourceWrapper);
assertEquals(underTest, result.getResourceResolver());
assertEquals(destination, result.getPath());
verify(wrappedResolver).copy(source, destination);
}
use of org.apache.sling.api.resource.ResourceWrapper in project sling by apache.
the class ResourceResolverWrapperTest method testResolve.
@Test
public void testResolve() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class);
final Resource resource = mock(Resource.class);
when(resource.getPath()).thenReturn(PATH);
when(wrappedResolver.resolve(request, PATH)).thenReturn(resource);
final Resource result = underTest.resolve(request, PATH);
assertTrue(result instanceof ResourceWrapper);
assertEquals(underTest, result.getResourceResolver());
assertEquals(resource.getPath(), result.getPath());
verify(wrappedResolver).resolve(request, PATH);
}
use of org.apache.sling.api.resource.ResourceWrapper in project sling by apache.
the class ResourceResolverWrapperTest method testGetResource.
@Test
public void testGetResource() throws Exception {
final Resource resource = mock(Resource.class);
when(resource.getPath()).thenReturn(PATH);
when(wrappedResolver.getResource(PATH)).thenReturn(resource);
final Resource result = underTest.getResource(PATH);
assertTrue(result instanceof ResourceWrapper);
assertEquals(underTest, result.getResourceResolver());
assertEquals(resource.getPath(), result.getPath());
verify(wrappedResolver).getResource(PATH);
}
Aggregations