mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Refactor Guava functional methods to use lambdas
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177027488
This commit is contained in:
parent
2ae496bfce
commit
bbe2584da4
47 changed files with 478 additions and 647 deletions
|
@ -17,11 +17,11 @@ package google.registry.model;
|
|||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EntityClasses.ALL_CLASSES;
|
||||
import static google.registry.model.EntityClasses.CLASS_TO_KIND_FUNCTION;
|
||||
import static google.registry.util.TypeUtils.hasAnnotation;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.EntitySubclass;
|
||||
import java.util.Set;
|
||||
|
@ -50,7 +50,7 @@ public class EntityClassesTest {
|
|||
ALL_CLASSES
|
||||
.stream()
|
||||
.filter(hasAnnotation(Entity.class))
|
||||
.map(CLASS_TO_KIND_FUNCTION)
|
||||
.map(Key::getKind)
|
||||
.collect(toImmutableSet()))
|
||||
.named("base entity kinds")
|
||||
.containsNoDuplicates();
|
||||
|
@ -62,13 +62,13 @@ public class EntityClassesTest {
|
|||
ALL_CLASSES
|
||||
.stream()
|
||||
.filter(hasAnnotation(Entity.class))
|
||||
.map(CLASS_TO_KIND_FUNCTION)
|
||||
.map(Key::getKind)
|
||||
.collect(toSet());
|
||||
Set<String> entitySubclassKinds =
|
||||
ALL_CLASSES
|
||||
.stream()
|
||||
.filter(hasAnnotation(EntitySubclass.class))
|
||||
.map(CLASS_TO_KIND_FUNCTION)
|
||||
.map(Key::getKind)
|
||||
.collect(toSet());
|
||||
assertThat(baseEntityKinds).named("base entity kinds").containsAllIn(entitySubclassKinds);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue