### Question:
ResourceUtil { public static Resource getPropertyReference(Resource resource, String namePattern) { String referencePath = getPropertyString(resource, namePattern); if (StringUtils.isNotBlank(referencePath)) { return resource.getResourceResolver().getResource(referencePath); } return null; } private  ResourceUtil(); static boolean getPropertyBoolean(Resource resource, String namePattern); static Calendar getPropertyCalendar(Resource resource, String namePattern); static Date getPropertyDate(Resource resource, String namePattern); static BigDecimal getPropertyDecimal(Resource resource, String namePattern); static Double getPropertyDouble(Resource resource, String namePattern); static Long getPropertyLong(Resource resource, String namePattern); static Resource getPropertyReference(Resource resource, String namePattern); static String getPropertyString(Resource resource, String namePattern); static List<String> getPropertyStrings(Resource resource, String namePattern);  }### Answer:
@Test public void testGetPropertyReference() { Resource reference = ResourceUtil.getPropertyReference(resource, "ref_prop"); assertNotNull(reference); assertEquals("/mynode/myothernode", reference.getPath()); }
@Test public void testGetPropertyReferenceReturnsNullIfPathNotFound() { assertNull(ResourceUtil.getPropertyReference(resource, "ref_prop_bad_path")); }
@Test public void testGetPropertyReferenceReturnsNullIfPropertyNotFound() { assertNull(ResourceUtil.getPropertyReference(resource, "bogus_prop_name")); }