use of com.google.common.truth.Truth8 in project cloud-opensource-java by GoogleCloudPlatform.
the class ClassPathBuilderTest method testResolve_removingDuplicates.
@Test
public void testResolve_removingDuplicates() throws InvalidVersionSpecificationException {
Artifact grpcArtifact = new DefaultArtifact("io.grpc:grpc-auth:1.15.1");
ClassPathResult result = classPathBuilder.resolve(ImmutableList.of(grpcArtifact), true, DependencyMediation.MAVEN);
ImmutableList<ClassPathEntry> classPath = result.getClassPath();
long jsr305Count = classPath.stream().filter(path -> path.toString().contains("jsr305")).count();
Truth.assertWithMessage("There should not be duplicated versions of jsr305").that(jsr305Count).isEqualTo(1);
Optional<ClassPathEntry> opencensusApiPathFound = classPath.stream().filter(path -> path.toString().contains("opencensus-api")).findFirst();
Truth8.assertThat(opencensusApiPathFound).isPresent();
ClassPathEntry opencensusApiPath = opencensusApiPathFound.get();
Truth.assertWithMessage("Opencensus API should have multiple dependency paths").that(result.getDependencyPaths(opencensusApiPath).size()).isGreaterThan(1);
}
Aggregations