@Test public void testFindVersions() throws MavenRepositoryException { RepositorySystem system = RepositoryUtility.newRepositorySystem(); ImmutableList<String> versions = RepositoryUtility.findVersions(system, "com.google.cloud", "libraries-bom"); Truth.assertThat(versions) .containsAtLeast("1.1.0", "1.1.1", "1.2.0", "2.0.0", "2.4.0", "2.5.0", "2.6.0") .inOrder(); }
public static ImmutableList<String> findVersions( RepositorySystem repositorySystem, String groupId, String artifactId) throws MavenRepositoryException { RepositorySystemSession session = RepositoryUtility.newSession(repositorySystem); return findVersionRange(repositorySystem, session, groupId, artifactId).getVersions().stream() .map(version -> version.toString()) .collect(toImmutableList()); }
RepositoryUtility { public static ImmutableList<String> findVersions( RepositorySystem repositorySystem, String groupId, String artifactId) throws MavenRepositoryException { RepositorySystemSession session = RepositoryUtility.newSession(repositorySystem); return findVersionRange(repositorySystem, session, groupId, artifactId).getVersions().stream() .map(version -> version.toString()) .collect(toImmutableList()); } }
RepositoryUtility { public static ImmutableList<String> findVersions( RepositorySystem repositorySystem, String groupId, String artifactId) throws MavenRepositoryException { RepositorySystemSession session = RepositoryUtility.newSession(repositorySystem); return findVersionRange(repositorySystem, session, groupId, artifactId).getVersions().stream() .map(version -> version.toString()) .collect(toImmutableList()); } private  RepositoryUtility(); }
RepositoryUtility { public static ImmutableList<String> findVersions( RepositorySystem repositorySystem, String groupId, String artifactId) throws MavenRepositoryException { RepositorySystemSession session = RepositoryUtility.newSession(repositorySystem); return findVersionRange(repositorySystem, session, groupId, artifactId).getVersions().stream() .map(version -> version.toString()) .collect(toImmutableList()); } private  RepositoryUtility(); static RepositorySystem newRepositorySystem(); static DefaultRepositorySystemSession newSession(RepositorySystem system); static DefaultRepositorySystemSession newSessionForMaven(RepositorySystem system); static RemoteRepository mavenRepositoryFromUrl(String mavenRepositoryUrl); static ImmutableList<String> findVersions(
      RepositorySystem repositorySystem, String groupId, String artifactId); static String findLatestCoordinates(
      RepositorySystem repositorySystem, String groupId, String artifactId); }
RepositoryUtility { public static ImmutableList<String> findVersions( RepositorySystem repositorySystem, String groupId, String artifactId) throws MavenRepositoryException { RepositorySystemSession session = RepositoryUtility.newSession(repositorySystem); return findVersionRange(repositorySystem, session, groupId, artifactId).getVersions().stream() .map(version -> version.toString()) .collect(toImmutableList()); } private  RepositoryUtility(); static RepositorySystem newRepositorySystem(); static DefaultRepositorySystemSession newSession(RepositorySystem system); static DefaultRepositorySystemSession newSessionForMaven(RepositorySystem system); static RemoteRepository mavenRepositoryFromUrl(String mavenRepositoryUrl); static ImmutableList<String> findVersions(
      RepositorySystem repositorySystem, String groupId, String artifactId); static String findLatestCoordinates(
      RepositorySystem repositorySystem, String groupId, String artifactId); static final RemoteRepository CENTRAL; }