@Test public void testGetApiVersionSolo() { String version = "foo"; String uriPath = version + "/bar"; UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getPath()).thenReturn(uriPath); assertTrue(ResourceUtil.getApiVersion(uriInfo).equals(version)); }
public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null; }
ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null; } }
ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null; }  }
ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null; }  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); }
ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { return uriPath; } } } return null; }  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);  }