### Question:
ResourceUtil { public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); }  static String getApiVersion(final UriInfo uriInfo); @Deprecated static List<EmbeddedLink> getSelfLink(final UriInfo uriInfo, final String userId, final EntityDefinition defn); static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId,
            final EntityDefinition defn); static EmbeddedLink getCustomLink(final UriInfo uriInfo, final String entityId, final EntityDefinition defn); @Deprecated static List<EmbeddedLink> getAssociationsLinks(final EntityDefinitionStore entityDefs,
            final EntityDefinition defn, final String id, final UriInfo uriInfo); static List<EmbeddedLink> getLinks(final EntityDefinitionStore entityDefs, final EntityDefinition defn,
            final EntityBody entityBody, final UriInfo uriInfo); static List<EmbeddedLink> getAggregateLink(final UriInfo uriInfo); static void putValue(MultivaluedMap<String, String> queryParameters, String key, String value); static void putValue(MultivaluedMap<String, String> queryParameters, String key, int value); static Map<String, String> convertToMap(Map<String, List<String>> map); static URI getURI(UriInfo uriInfo, String... paths); static String getVersionedUriString(UriInfo uriInfo, String... paths); static SLIPrincipal getSLIPrincipalFromSecurityContext(); static String getLinkName(String resourceName, String referenceName, String referenceField,
            boolean isReferenceEntity);  }### Answer:
@Test public void testGetApiVersionLinked() { String version = "bar"; String uriPath = version + "/foo"; UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getPath()).thenReturn(uriPath); when(uriInfo.getBaseUriBuilder()).thenReturn(this.createUriBuilder()); EntityDefinition defn = mock(EntityDefinition.class); String resourceName = "baz"; when(defn.getResourceName()).thenReturn(resourceName); String entityId = "entityId"; PathConstants.TEMP_MAP.put(resourceName, resourceName); EmbeddedLink embeddedLink = ResourceUtil.getSelfLinkForEntity(uriInfo, entityId, defn); String href = embeddedLink.getHref(); assertTrue(href.contains(version + "/" + resourceName + "/" + entityId)); }