aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/java/com/google/common/truth/TruthAssertThatTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/com/google/common/truth/TruthAssertThatTest.java')
-rw-r--r--core/src/test/java/com/google/common/truth/TruthAssertThatTest.java39
1 files changed, 11 insertions, 28 deletions
diff --git a/core/src/test/java/com/google/common/truth/TruthAssertThatTest.java b/core/src/test/java/com/google/common/truth/TruthAssertThatTest.java
index 90769484..cb75b934 100644
--- a/core/src/test/java/com/google/common/truth/TruthAssertThatTest.java
+++ b/core/src/test/java/com/google/common/truth/TruthAssertThatTest.java
@@ -18,10 +18,8 @@ package com.google.common.truth;
import static com.google.common.truth.Truth.assert_;
import static java.util.Arrays.asList;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import com.google.common.reflect.TypeToken;
@@ -38,38 +36,23 @@ import org.junit.runners.JUnit4;
*/
@RunWith(JUnit4.class)
public class TruthAssertThatTest {
- private static final Function<Method, TypeToken<?>> METHOD_TO_RETURN_TYPE_TOKEN =
- new Function<Method, TypeToken<?>>() {
- @Override
- public TypeToken<?> apply(Method input) {
- return TypeToken.of(Iterables.getOnlyElement(asList(input.getParameterTypes())));
- }
- };
+ private static TypeToken<?> methodToReturnTypeToken(Method input) {
+ return TypeToken.of(Iterables.getOnlyElement(asList(input.getParameterTypes())));
+ }
@Test
public void staticAssertThatMethodsMatchStandardSubjectBuilderInstanceMethods() {
- ImmutableSet<TypeToken<?>> verbTypes =
+ ImmutableSortedSet<TypeToken<?>> verbTypes =
FluentIterable.from(asList(StandardSubjectBuilder.class.getMethods()))
- .filter(
- new Predicate<Method>() {
- @Override
- public boolean apply(Method input) {
- return input.getName().equals("that");
- }
- })
- .transform(METHOD_TO_RETURN_TYPE_TOKEN)
+ .filter(input -> input.getName().equals("that"))
+ .transform(TruthAssertThatTest::methodToReturnTypeToken)
.toSortedSet(Ordering.usingToString());
- ImmutableSet<TypeToken<?>> truthTypes =
+ ImmutableSortedSet<TypeToken<?>> truthTypes =
FluentIterable.from(asList(Truth.class.getMethods()))
.filter(
- new Predicate<Method>() {
- @Override
- public boolean apply(Method input) {
- return input.getName().equals("assertThat")
- && Modifier.isStatic(input.getModifiers());
- }
- })
- .transform(METHOD_TO_RETURN_TYPE_TOKEN)
+ input ->
+ input.getName().equals("assertThat") && Modifier.isStatic(input.getModifiers()))
+ .transform(TruthAssertThatTest::methodToReturnTypeToken)
.toSortedSet(Ordering.usingToString());
assert_().that(verbTypes).isNotEmpty();