### Question:
SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; }  static String getUserId(final Resource resource); static String getContentPath(final Resource resource); static boolean isUser(final SlingHttpServletRequest request);  }### Answer:
@Test public void getContentPath_match() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin/hobby"); assertThat(SlingshotUtil.getContentPath(resource), equalTo("/hobby")); }
@Test public void getContentPath_noMatch() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin"); assertThat(SlingshotUtil.getContentPath(resource), nullValue()); }