### Question:
LinkageMonitor { @VisibleForTesting static Bom copyWithSnapshot( RepositorySystem repositorySystem, RepositorySystemSession session, Bom bom, Map<String, String> localArtifacts) throws ModelBuildingException, ArtifactResolutionException { ImmutableList.Builder<Artifact> managedDependencies = ImmutableList.builder(); Model model = buildModelWithSnapshotBom(repositorySystem, session, bom.getCoordinates(), localArtifacts); ArtifactTypeRegistry registry = session.getArtifactTypeRegistry(); ImmutableList<Artifact> newManagedDependencies = model.getDependencyManagement().getDependencies().stream() .map(dependency -> RepositoryUtils.toDependency(dependency, registry)) .map(Dependency::getArtifact) .collect(toImmutableList()); for (Artifact managedDependency : newManagedDependencies) { if (Bom.shouldSkipBomMember(managedDependency)) { continue; } String version = localArtifacts.getOrDefault( managedDependency.getGroupId() + ":" + managedDependency.getArtifactId(), managedDependency.getVersion()); managedDependencies.add(managedDependency.setVersion(version)); } return new Bom(bom.getCoordinates() + "-SNAPSHOT", managedDependencies.build()); }  static void main(String[] arguments);  }### Answer:
@Test public void testBomSnapshot() throws ModelBuildingException, ArtifactResolutionException, ArtifactDescriptorException { Bom bom = Bom.readBom("com.google.cloud:libraries-bom:1.2.0"); Bom snapshotBom = LinkageMonitor.copyWithSnapshot( system, session, bom, ImmutableMap.of("com.google.protobuf:protobuf-java", "3.8.0-SNAPSHOT")); assertWithMessage( "The first element of the SNAPSHOT BOM should be the same as the original BOM") .that(toCoordinates(snapshotBom.getManagedDependencies().get(0))) .isEqualTo("com.google.protobuf:protobuf-java:3.8.0-SNAPSHOT"); assertWithMessage("Artifacts other than protobuf-java should have the original version") .that(skip(snapshotBom.getManagedDependencies(), 1)) .comparingElementsUsing( transforming( Artifacts::toCoordinates, Artifacts::toCoordinates, "has the same Maven coordinates as")) .containsExactlyElementsIn(skip(bom.getManagedDependencies(), 1)) .inOrder(); }