mirror of
https://github.com/google/nomulus
synced 2026-08-27 19:37:07 +00:00
Replace assertThat(stream.collect(toImmutableList())) with assertThat(stream)
In Truth8, we can do assertThat(stream) directly. It's less verbose and clearer in most cases. Note that for the "finishers" (e.g. "containsExactyElementsIn") - streams are still not allowed. So when there is: assertThat(stream.map(someTransformation).collect(toList())) .containsExactlyElementsIn(expecteStream.map(someTransformation).collect(toList())); I kept the .collect in the assertThat to preserve the symmetry with the finisher. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179697587
This commit is contained in:
@@ -16,6 +16,7 @@ package google.registry.model;
|
||||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.EntityClasses.ALL_CLASSES;
|
||||
import static google.registry.util.TypeUtils.hasAnnotation;
|
||||
|
||||
@@ -45,12 +46,7 @@ public class EntityClassesTest {
|
||||
|
||||
@Test
|
||||
public void testEntityClasses_baseEntitiesHaveUniqueKinds() throws Exception {
|
||||
assertThat(
|
||||
ALL_CLASSES
|
||||
.stream()
|
||||
.filter(hasAnnotation(Entity.class))
|
||||
.map(Key::getKind)
|
||||
.collect(toImmutableSet()))
|
||||
assertThat(ALL_CLASSES.stream().filter(hasAnnotation(Entity.class)).map(Key::getKind))
|
||||
.named("base entity kinds")
|
||||
.containsNoDuplicates();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user