### Question:
DesignReferenceProvider implements ReferenceProvider { @Override public List<Reference> findReferences(Resource resource) { ResourceResolver resourceResolver = resource.getResourceResolver(); PageManager pageManager = resourceResolver.adaptTo(PageManager.class); Designer designer = resourceResolver.adaptTo(Designer.class); Page page = pageManager.getContainingPage(resource); if (page == null) { return Collections.emptyList(); } Design design = designer.getDesign(page); if (design == null) { return Collections.emptyList(); } return Collections.singletonList(new Reference(TYPE_DESIGN_PAGE, String.format("%s (Design)", design.getId()), design.getContentResource(), getLastModified(design))); }  @Override List<Reference> findReferences(Resource resource);  }### Answer:
@Test public void testfindReferencesWithDesignPathinResource() { when(designer.getDesign(page)).thenReturn(design); List<Reference> ref = instance.findReferences(resource); assertNotNull(ref); assertEquals(1, ref.size()); assertEquals(designResource, ref.get(0).getResource()); assertEquals("designpage", ref.get(0).getType()); assertEquals("test (Design)", ref.get(0).getName()); }
@Test public void testfindReferencesWithNoDesignPathinResource() { List<Reference> ref = instance.findReferences(resource); assertNotNull(ref); assertEquals(0, ref.size()); }