[java-support] branch master updated: IDP-1405 - Remove use of Guava Function/Predicate interfaces

Scott Cantor cantor.2 at osu.edu
Tue Feb 5 10:48:06 EST 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=647a54798d135d33484516bdb20b2e09603dd05a

The following commit(s) were added to refs/heads/master by this push:
       new  647a547   IDP-1405 - Remove use of Guava Function/Predicate interfaces
647a547 is described below

commit 647a54798d135d33484516bdb20b2e09603dd05a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Feb 1 15:41:48 2019 -0500

    IDP-1405 - Remove use of Guava Function/Predicate interfaces
    
    https://issues.shibboleth.net/jira/browse/IDP-1405
---
 .../java/support/codec/StringDigester.java         |   5 +-
 .../java/support/collection/CollectionSupport.java |  18 ++-
 .../java/support/collection/IterableSupport.java   |   5 +-
 .../support/logic/AbstractTriStatePredicate.java   |   4 +-
 .../java/support/logic/AllMatchPredicate.java      |  13 +-
 .../java/support/logic/AnyMatchPredicate.java      |  13 +-
 .../logic/CaseInsensitiveStringMatchPredicate.java |   9 +-
 .../java/support/logic/FunctionSupport.java        |  25 +++-
 .../logic/{FunctionSupport.java => Predicate.java} |  39 +++--
 .../java/support/logic/PredicateSupport.java       | 160 ++++++++++++++++++++-
 .../java/support/logic/RegexPredicate.java         |   7 +-
 .../java/support/logic/ScriptedFunction.java       |   3 +-
 .../java/support/logic/ScriptedPredicate.java      |   4 +-
 .../support/logic/StrategyIndirectedPredicate.java |  14 +-
 .../support/logic/TransformAndCheckFunction.java   |  15 +-
 .../support/logic/TrimOrNullStringFunction.java    |   3 +-
 .../support/net/DynamicResponseHeaderFilter.java   |   2 +-
 .../java/support/net/MediaTypeSupport.java         |   6 +-
 .../net/StripMediaTypeParametersFunction.java      |   7 +-
 .../java/support/primitive/StringSupport.java      |   2 +-
 .../resolver/CriterionPredicateRegistry.java       |   7 +-
 .../java/support/resolver/ResolverSupport.java     |  14 +-
 .../utilities/java/support/velocity/Template.java  |  10 +-
 .../java/support/collection/CollectionTest.java    |   2 +-
 .../java/support/logic/AllMatchPredicateTest.java  |  12 +-
 .../java/support/logic/AnyMatchPredicateTest.java  |  12 +-
 .../CaseInsensitiveStringMatchPredicateTest.java   |  12 +-
 .../ComponentInitializationExceptionFunction.java  |   4 +-
 .../ComponentInitializationExceptionPredicate.java |   4 +-
 .../java/support/logic/ExceptionFunction.java      |   4 +-
 .../java/support/logic/ExceptionPredicate.java     |   4 +-
 .../utilities/java/support/logic/ScriptedTest.java |  22 +--
 .../logic/TransformAndCheckFunctionTest.java       |  19 +--
 .../resolver/CriterionPredicateRegistryTest.java   |   3 +-
 .../support/resolver/EvaluableFooCriterion.java    |   2 +-
 .../resolver/EvaluableTestFooCriterion.java        |   2 +-
 .../java/support/resolver/FooPredicate.java        |   4 +-
 .../java/support/resolver/ResolverSupportTest.java |   2 +-
 38 files changed, 318 insertions(+), 175 deletions(-)

diff --git a/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java b/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
index 8acea92..87b3f5e 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
@@ -20,6 +20,7 @@ package net.shibboleth.utilities.java.support.codec;
 import java.nio.charset.Charset;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.util.function.Function;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -34,14 +35,12 @@ import org.apache.commons.codec.binary.Hex;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Function;
-
 /**
  * A function impl which accepts a String input, digests it according to a specified {@link MessageDigest} algorithm,
  * and then returns the output in a specified format: Base64-encoded or hexadecimal with with lower or upper 
  * case characters.
  */
-public class StringDigester implements Function<String, String> {
+public class StringDigester implements Function<String,String> {
     
     /** The output format determining how the the digested byte[] is converted to the output String. */
     public enum OutputFormat {
diff --git a/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java b/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java
index 24e1e14..bc93eb7 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/collection/CollectionSupport.java
@@ -18,16 +18,14 @@
 package net.shibboleth.utilities.java.support.collection;
 
 import java.util.Collection;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Predicate;
-
 /** Helper methods for working with collections of objects. */
 public final class CollectionSupport {
 
@@ -48,7 +46,7 @@ public final class CollectionSupport {
      */
     public static <T> boolean addIf(@Nonnull final Collection<? super T> target, @Nullable final T element,
             @Nonnull final Predicate<? super T> predicate) {
-        return addIf(target, element, predicate, Functions.<T> identity());
+        return addIf(target, element, predicate, t -> t);
     }
 
     /**
@@ -73,7 +71,7 @@ public final class CollectionSupport {
         }
 
         final T processedElement = elementPreprocessor.apply(element);
-        if (predicate.apply(processedElement)) {
+        if (predicate.test(processedElement)) {
             return target.add(processedElement);
         }
 
@@ -92,7 +90,7 @@ public final class CollectionSupport {
      */
     public static <T> boolean addIf(@Nonnull final Collection<? super T> target, @Nullable final Collection<T> elements,
             @Nonnull final Predicate<? super T> predicate) {
-        return addIf(target, elements, predicate, Functions.<T> identity());
+        return addIf(target, elements, predicate, t -> t);
     }
 
     /**
@@ -135,7 +133,7 @@ public final class CollectionSupport {
      */
     public static <T> boolean removeIf(@Nonnull final Collection<T> target, @Nullable final T element,
             @Nonnull final Predicate<? super T> predicate) {
-        return removeIf(target, element, predicate, Functions.<T> identity());
+        return removeIf(target, element, predicate, t -> t);
     }
 
     /**
@@ -160,7 +158,7 @@ public final class CollectionSupport {
         }
 
         final T processedElement = elementPreprocessor.apply(element);
-        if (predicate.apply(processedElement)) {
+        if (predicate.test(processedElement)) {
             return target.remove(processedElement);
         }
 
@@ -180,7 +178,7 @@ public final class CollectionSupport {
      */
     public static <T> boolean removeIf(@Nonnull final Collection<T> target, @Nullable final Collection<T> elements,
             @Nonnull final Predicate<? super T> predicate) {
-        return removeIf(target, elements, predicate, Functions.<T> identity());
+        return removeIf(target, elements, predicate, t -> t);
     }
 
     /**
diff --git a/src/main/java/net/shibboleth/utilities/java/support/collection/IterableSupport.java b/src/main/java/net/shibboleth/utilities/java/support/collection/IterableSupport.java
index 1639ff6..50cd54c 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/collection/IterableSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/collection/IterableSupport.java
@@ -17,12 +17,13 @@
 
 package net.shibboleth.utilities.java.support.collection;
 
+import java.util.function.Predicate;
+
 import javax.annotation.Nonnull;
 
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Iterables;
 
@@ -45,7 +46,7 @@ public final class IterableSupport {
         Constraint.isNotNull(clazz, "Class can not be null");
         
         final Predicate<Object> instanceOf = Predicates.instanceOf(clazz);
-        final Optional<?> result = Iterables.tryFind(target, instanceOf);
+        final Optional<?> result = Iterables.tryFind(target, instanceOf::test);
         return result.isPresent();
     }
 
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/AbstractTriStatePredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/AbstractTriStatePredicate.java
index e322fe3..04171f7 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/AbstractTriStatePredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/AbstractTriStatePredicate.java
@@ -17,8 +17,6 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
-import com.google.common.base.Predicate;
-
 /**
  * A base {@link Predicate} implementation which provides support for cases where the
  * predicate can not meaningfully evaluate the input.  The flags on this class
@@ -71,4 +69,4 @@ public abstract class AbstractTriStatePredicate<T> implements Predicate<T> {
         unevaluableSatisfies = flag;
     }
 
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java
index f3f1ef7..a69c369 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java
@@ -20,8 +20,6 @@ package net.shibboleth.utilities.java.support.logic;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import com.google.common.base.Predicate;
-
 /**
  * A {@link Predicate} that checks that all items in an {@link Iterable} match a given target predicate. If the given
  * {@link Iterable} is null or contains no items this method will return <code>false</code>, otherwise it passes each
@@ -34,26 +32,26 @@ import com.google.common.base.Predicate;
 public class AllMatchPredicate<T> implements Predicate<Iterable<T>> {
 
     /** The predicate applied to each value of the {@link Iterable}. */
-    private final Predicate<T> predicate;
+    @Nonnull private final java.util.function.Predicate<T> predicate;
 
     /**
      * Constructor.
      * 
      * @param target the target predicate against which all {@link Iterable} elements are evaluated
      */
-    public AllMatchPredicate(@Nonnull final Predicate<T> target) {
-        predicate = Constraint.isNotNull(target, "Target predicate can not be null");
+    public AllMatchPredicate(@Nonnull final java.util.function.Predicate<T> target) {
+        predicate = Constraint.isNotNull(target, "Target predicate cannot be null");
     }
 
     /** {@inheritDoc} */
-    public boolean apply(@Nullable final Iterable<T> inputs) {
+    public boolean test(@Nullable final Iterable<T> inputs) {
         if (inputs == null) {
             return false;
         }
 
         boolean matchedAll = false;
         for (final T input : inputs) {
-            if (!predicate.apply(input)) {
+            if (!predicate.test(input)) {
                 return false;
             } else {
                 matchedAll = true;
@@ -62,4 +60,5 @@ public class AllMatchPredicate<T> implements Predicate<Iterable<T>> {
 
         return matchedAll;
     }
+    
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java
index ff46c4f..a319311 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java
@@ -20,8 +20,6 @@ package net.shibboleth.utilities.java.support.logic;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import com.google.common.base.Predicate;
-
 /**
  * A {@link Predicate} that checks that any item in an {@link Iterable} matches a given target predicate. If the given
  * {@link Iterable} is null or contains no items this method will return <code>false</code>, otherwise it passes each
@@ -34,29 +32,30 @@ import com.google.common.base.Predicate;
 public class AnyMatchPredicate<T> implements Predicate<Iterable<T>> {
 
     /** The predicate applied to each value of the {@link Iterable}. */
-    private final Predicate<T> predicate;
+    @Nonnull private final java.util.function.Predicate<T> predicate;
 
     /**
      * Constructor.
      * 
      * @param target the target predicate against which all {@link Iterable} elements are evaluated
      */
-    public AnyMatchPredicate(@Nonnull final Predicate<T> target) {
-        predicate = Constraint.isNotNull(target, "Target predicate can not be null");
+    public AnyMatchPredicate(@Nonnull final java.util.function.Predicate<T> target) {
+        predicate = Constraint.isNotNull(target, "Target predicate cannot be null");
     }
 
     /** {@inheritDoc} */
-    public boolean apply(@Nullable final Iterable<T> inputs) {
+    public boolean test(@Nullable final Iterable<T> inputs) {
         if (inputs == null) {
             return false;
         }
 
         for (final T input : inputs) {
-            if (predicate.apply(input)) {
+            if (predicate.test(input)) {
                 return true;
             }
         }
 
         return false;
     }
+    
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicate.java
index 37e7919..e7e3bb1 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicate.java
@@ -19,8 +19,6 @@ package net.shibboleth.utilities.java.support.logic;
 
 import javax.annotation.Nonnull;
 
-import com.google.common.base.Predicate;
-
 /**
  * A {@link Predicate} that checks that a given input string matches a target string while ignoring case. If a given
  * input is <code>null</code> this predicate returns <code>false</code>.
@@ -28,7 +26,7 @@ import com.google.common.base.Predicate;
 public class CaseInsensitiveStringMatchPredicate implements Predicate<CharSequence> {
 
     /** The target string. */
-    private final String target;
+    @Nonnull private final String target;
 
     /**
      * Constructor.
@@ -36,15 +34,16 @@ public class CaseInsensitiveStringMatchPredicate implements Predicate<CharSequen
      * @param matchString that string against which predicate inputs will be checked
      */
     public CaseInsensitiveStringMatchPredicate(@Nonnull final String matchString) {
-        target = Constraint.isNotNull(matchString, "Target string can not be null");
+        target = Constraint.isNotNull(matchString, "Target string cannot be null");
     }
 
     /** {@inheritDoc} */
-    public boolean apply(final CharSequence input) {
+    public boolean test(final CharSequence input) {
         if (input == null) {
             return false;
         }
 
         return target.equalsIgnoreCase(input.toString());
     }
+    
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java b/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
index d0c4a62..dbf7c63 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
@@ -17,11 +17,14 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
+import java.util.function.Function;
+
 import javax.annotation.Nonnull;
 
-import com.google.common.base.Function;
 import com.google.common.base.Functions;
 
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
+
 /**
  * Helper class for constructing functions that are fully generic, in contrast to the broken,
  * Object-bound types Guava can build.
@@ -43,8 +46,26 @@ public final class FunctionSupport {
      * 
      * @return the constructed function
      */
-    @Nonnull public static <T1,T2> Function<T1,T2> constant(@Nonnull final T2 target) {
+    @Nonnull public static <T1,T2> Function<T1,T2> constant(@Nonnull @ParameterName(name="target") final T2 target) {
         return (Function<T1, T2>) Functions.constant(target);
     }
 
+    /**
+     * Returns the composition of two functions. For {@code f: A->B} and {@code g: B->C}, composition
+     * is defined as the function h such that {@code h(a) == g(f(a))} for each {@code a}.
+     *
+     * @param <A> input to composed function
+     * @param <B> output of inner function
+     * @param <C> output of composed function
+     *
+     * @param g the second function to apply
+     * @param f the first function to apply
+     * @return the composition of {@code f} and {@code g}
+     * @see <a href="//en.wikipedia.org/wiki/Function_composition">function composition</a>
+     */
+    @Nonnull public static <A,B,C> Function<A,C> compose(@Nonnull @ParameterName(name="g") final Function<B,C> g,
+            @Nonnull @ParameterName(name="f") final Function<A,? extends B> f) {
+        return g.compose(f);
+    }
+
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java b/src/main/java/net/shibboleth/utilities/java/support/logic/Predicate.java
similarity index 51%
copy from src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
copy to src/main/java/net/shibboleth/utilities/java/support/logic/Predicate.java
index d0c4a62..2243897 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/Predicate.java
@@ -17,34 +17,33 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
-import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport.ObjectType;
 
 /**
- * Helper class for constructing functions that are fully generic, in contrast to the broken,
- * Object-bound types Guava can build.
+ * A convenience interface to allow our own classes to implement the Java
+ * {@link java.util.function.Predicate} and log any calls to the
+ * {@link #apply(T)} method as deprecated.
+ * 
+ * @param <T> type of object upon which this predicate operates
  */
-public final class FunctionSupport {
-
-    /** Constructor. */
-    private FunctionSupport() {
-        
-    }
+public interface Predicate<T> extends java.util.function.Predicate<T> {
 
     /**
-     * Creates a function that returns a constant value, like {@link Functions#constant(Object)}, but
-     * with the type of input parameterized as well as the output.
+     * Default method to log deprecated use of Guava's apply() signature.
      * 
-     * @param <T1> type of object the function needs to act on
-     * @param <T2> type of object being returned
-     * @param target the value to return from the function
+     * @param input input to predicate
      * 
-     * @return the constructed function
+     * @return the result of the {@link #test(T)} method
+     * @deprecated
      */
-    @Nonnull public static <T1,T2> Function<T1,T2> constant(@Nonnull final T2 target) {
-        return (Function<T1, T2>) Functions.constant(target);
+    @Deprecated
+    default boolean apply(@Nullable final T input) {
+        DeprecationSupport.warn(ObjectType.METHOD, "apply", "on Predicate objects", "test");
+        
+        return test(input);
     }
-
+    
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java b/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
index cc4b5c0..27f4dc6 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
@@ -17,11 +17,13 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
+import java.util.ArrayList;
+import java.util.function.Function;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
 
 /**
  * Helper class for constructing predicates. Especially useful for creating internal DSLs via Java's static method
@@ -41,7 +43,7 @@ public final class PredicateSupport {
      * 
      * @return the constructed predicate
      */
-    @Nonnull public static <T> Predicate<Iterable<T>> allMatch(@Nonnull final Predicate<T> target) {
+    @Nonnull public static <T> Predicate<Iterable<T>> allMatch(@Nonnull final java.util.function.Predicate<T> target) {
         return new AllMatchPredicate<>(target);
     }
 
@@ -53,7 +55,7 @@ public final class PredicateSupport {
      * 
      * @return the constructed predicate
      */
-    @Nonnull public static <T> Predicate<Iterable<T>> anyMatch(@Nonnull final Predicate<T> target) {
+    @Nonnull public static <T> Predicate<Iterable<T>> anyMatch(@Nonnull final java.util.function.Predicate<T> target) {
         return new AnyMatchPredicate<>(target);
     }
 
@@ -82,13 +84,157 @@ public final class PredicateSupport {
      *  @since 7.4.0
      */
     @Nonnull public static <T> Predicate<T> fromFunction(@Nonnull final Function<T,Boolean> function,
-            @Nonnull final Predicate<T> defValue) {
+            @Nonnull final java.util.function.Predicate<T> defValue) {
         return new Predicate<T>() {
-            public boolean apply(@Nullable final T input) {
+            public boolean test(@Nullable final T input) {
                 final Boolean result = function.apply(input);
-                return result != null ? result : defValue.apply(input);
+                return result != null ? result : defValue.test(input);
             }
         };
     }
     
+    /**
+     * Returns a predicate that evaluates to {@code true} if the given predicate evaluates to {@code
+     * false}.
+     * 
+     * @param <T> predicate input type
+     * @param predicate the predicate to negate
+     * 
+     * @return the negated predicate
+     */
+    @Nonnull public static <T> Predicate<T> not(@Nonnull final java.util.function.Predicate<T> predicate) {
+        return predicate.negate()::test;
+    }
+
+    /**
+     * Returns a predicate that evaluates to {@code true} if each of its components evaluates to
+     * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited"
+     * as soon as a false predicate is found. It defensively copies the iterable passed in, so future
+     * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the
+     * returned predicate will always evaluate to {@code true}.
+     * 
+     * @param <T> predicate input type
+     * @param components the predicates to combine
+     * 
+     * @return the composite predicate
+     */
+    @Nonnull public static <T> Predicate<T> and(
+            @Nonnull final Iterable<? extends java.util.function.Predicate<? super T>> components) {
+        
+        final ArrayList<com.google.common.base.Predicate<T>> copy = new ArrayList<>();
+        for (final java.util.function.Predicate<? super T> p : components) {
+            copy.add(p::test);
+        }
+        
+        return Predicates.and(copy)::test;
+    }
+
+    /**
+     * Returns a predicate that evaluates to {@code true} if each of its components evaluates to
+     * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited"
+     * as soon as a false predicate is found. It defensively copies the iterable passed in, so future
+     * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the
+     * returned predicate will always evaluate to {@code true}.
+     * 
+     * @param <T> predicate input type
+     * @param components the predicates to combine
+     * 
+     * @return the composite predicate
+     */
+    @SafeVarargs
+    @Nonnull public static <T> Predicate<T> and(
+            @Nonnull final java.util.function.Predicate<? super T>... components) {
+        final ArrayList<com.google.common.base.Predicate<T>> copy = new ArrayList<>();
+        for (final java.util.function.Predicate<? super T> p : components) {
+            copy.add(p::test);
+        }
+        
+        return Predicates.and(copy)::test;
+    }
+
+    /**
+     * Returns a predicate that evaluates to {@code true} if each of its components evaluates to
+     * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited"
+     * as soon as a false predicate is found. It defensively copies the iterable passed in, so future
+     * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the
+     * returned predicate will always evaluate to {@code true}.
+     * 
+     * @param <T> predicate input type
+     * @param first the first predicate
+     * @param second the second predicate
+     * 
+     * @return the composite predicate
+     */
+    @Nonnull public static <T> Predicate<T> and(@Nonnull final java.util.function.Predicate<? super T> first,
+            @Nonnull final java.util.function.Predicate<? super T> second) {
+        
+        return t -> first.test(t) && second.test(t);
+    }
+    
+    /**
+     * Returns a predicate that evaluates to {@code true} if any one of its components evaluates to
+     * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited"
+     * as soon as a true predicate is found. It defensively copies the iterable passed in, so future
+     * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the
+     * returned predicate will always evaluate to {@code false}.
+     * 
+     * @param <T> predicate input type
+     * @param components the predicates to combine
+     * 
+     * @return the composite predicate
+     */
+    @Nonnull public static <T> Predicate<T> or(
+            @Nonnull final Iterable<? extends java.util.function.Predicate<? super T>> components) {
+        
+        final ArrayList<com.google.common.base.Predicate<T>> copy = new ArrayList<>();
+        for (final java.util.function.Predicate<? super T> p : components) {
+            copy.add(p::test);
+        }
+        
+        return Predicates.or(copy)::test;
+    }
+
+    /**
+     * Returns a predicate that evaluates to {@code true} if any one of its components evaluates to
+     * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited"
+     * as soon as a true predicate is found. It defensively copies the iterable passed in, so future
+     * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the
+     * returned predicate will always evaluate to {@code false}.
+     * 
+     * @param <T> predicate input type
+     * @param components the predicates to combine
+     * 
+     * @return the composite predicate
+     */
+    @SafeVarargs
+    @Nonnull public static <T> Predicate<T> or(
+            @Nonnull final java.util.function.Predicate<? super T>... components) {
+        
+        final ArrayList<com.google.common.base.Predicate<T>> copy = new ArrayList<>();
+        for (final java.util.function.Predicate<? super T> p : components) {
+            copy.add(p::test);
+        }
+        
+        return Predicates.or(copy)::test;
+    }
+
+    /**
+     * Returns a predicate that evaluates to {@code true} if any one of its components evaluates to
+     * {@code true}. The components are evaluated in order, and evaluation will be "short-circuited"
+     * as soon as a true predicate is found. It defensively copies the iterable passed in, so future
+     * changes to it won't alter the behavior of this predicate. If {@code components} is empty, the
+     * returned predicate will always evaluate to {@code false}.
+     * 
+     * @param <T> predicate input type
+     * @param first the first predicate
+     * @param second the second predicate
+     * 
+     * @return the composite predicate
+     */
+    @Nonnull public static <T> Predicate<T> or(@Nonnull final java.util.function.Predicate<? super T> first,
+            @Nonnull final java.util.function.Predicate<? super T> second) {
+        
+        return t -> first.test(t) || second.test(t);
+    }
+    
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/RegexPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/RegexPredicate.java
index a92c213..0be2b92 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/RegexPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/RegexPredicate.java
@@ -20,9 +20,6 @@ package net.shibboleth.utilities.java.support.logic;
 import java.util.regex.Pattern;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import com.google.common.base.Predicate;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
@@ -35,7 +32,7 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 public class RegexPredicate implements Predicate<CharSequence> {
 
     /** Regular expression. */
-    @Nullable private Pattern pattern;
+    @Nonnull  private Pattern pattern;
 
     /**
      * Pattern constructor.
@@ -56,7 +53,7 @@ public class RegexPredicate implements Predicate<CharSequence> {
     }
 
     /** {@inheritDoc} */
-    public boolean apply(final CharSequence input) {
+    public boolean test(final CharSequence input) {
         if (input == null) {
             return false;
         }
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedFunction.java b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedFunction.java
index 7476e8b..45c08f6 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedFunction.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedFunction.java
@@ -20,6 +20,7 @@ package net.shibboleth.utilities.java.support.logic;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.function.Function;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -35,8 +36,6 @@ import net.shibboleth.utilities.java.support.scripting.EvaluableScript;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Function;
-
 /**
  * A {@link Function} which calls out to a supplied script.
  *
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedPredicate.java
index cf07bd4..463ef13 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedPredicate.java
@@ -35,8 +35,6 @@ import net.shibboleth.utilities.java.support.scripting.EvaluableScript;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Predicate;
-
 /**
  * A {@link Predicate} which calls out to a supplied script.
  * 
@@ -85,7 +83,7 @@ public class ScriptedPredicate<T> extends AbstractScriptEvaluator implements Pre
     }
     
     /** {@inheritDoc} */
-    public boolean apply(@Nullable final T input) {
+    public boolean test(@Nullable final T input) {
         
         final Object result = evaluate(input);
         return (boolean) (result != null ? result : getReturnOnError());
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/StrategyIndirectedPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/StrategyIndirectedPredicate.java
index c49c2a7..5638451 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/StrategyIndirectedPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/StrategyIndirectedPredicate.java
@@ -18,12 +18,11 @@
 package net.shibboleth.utilities.java.support.logic;
 
 import java.util.Collection;
+import java.util.function.Function;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
 
 /**
@@ -39,7 +38,7 @@ public class StrategyIndirectedPredicate<T1,T2> implements Predicate<T1> {
     @Nonnull private final Function<T1,T2> objectLookupStrategy;
     
     /** Predicate to apply to indirected object. */
-    @Nonnull private final Predicate<T2> predicate;
+    @Nonnull private final java.util.function.Predicate<T2> predicate;
     
     /**
      * Constructor.
@@ -48,7 +47,7 @@ public class StrategyIndirectedPredicate<T1,T2> implements Predicate<T1> {
      * @param pred the predicate to apply
      */
     public StrategyIndirectedPredicate(@Nonnull final Function<T1,T2> objectStrategy,
-            @Nonnull final Predicate<T2> pred) {
+            @Nonnull final java.util.function.Predicate<T2> pred) {
         objectLookupStrategy = Constraint.isNotNull(objectStrategy, "Object lookup strategy cannot be null");
         predicate = Constraint.isNotNull(pred, "Predicate cannot be null");
     }
@@ -67,9 +66,8 @@ public class StrategyIndirectedPredicate<T1,T2> implements Predicate<T1> {
     }
     
     /** {@inheritDoc} */
-    @Override
-    public boolean apply(@Nullable final T1 input) {
-        return predicate.apply(objectLookupStrategy.apply(input));
+    public boolean test(@Nullable final T1 input) {
+        return predicate.test(objectLookupStrategy.apply(input));
     }
     
     /**
@@ -86,7 +84,7 @@ public class StrategyIndirectedPredicate<T1,T2> implements Predicate<T1> {
      * @since 7.3.0
      */
     @Nonnull public static <T1,T2> StrategyIndirectedPredicate<T1,T2> forPredicate(
-            @Nonnull final Function<T1,T2> objectStrategy, @Nonnull final Predicate<T2> pred) {
+            @Nonnull final Function<T1,T2> objectStrategy, @Nonnull final java.util.function.Predicate<T2> pred) {
         return new StrategyIndirectedPredicate<>(objectStrategy, pred);
     }
 
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunction.java b/src/main/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunction.java
index 150c4db..543d9ed 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunction.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunction.java
@@ -17,14 +17,14 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
+import java.util.Objects;
+import java.util.function.Function;
+
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.ThreadSafe;
 
-import com.google.common.base.Function;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
 import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
 
 /**
  * A {@link Function} that receives an input, runs it through a pre-processor and checks the result against a
@@ -41,7 +41,7 @@ public class TransformAndCheckFunction<T> implements Function<T, Optional<? exte
     private final Function<T, ? extends T> preprocessor;
 
     /** A constraint which must be met in order for an input to be valid. */
-    private final Predicate<T> constraint;
+    private final java.util.function.Predicate<T> constraint;
 
     /** Whether input that does not meet the constraint should cause an error or just be silently dropped. */
     private final boolean failOnConstraintViolation;
@@ -55,7 +55,8 @@ public class TransformAndCheckFunction<T> implements Function<T, Optional<? exte
      *            just be ignored
      */
     public TransformAndCheckFunction(@Nonnull final Function<T, ? extends T> inputPreprocessor,
-            @Nonnull final Predicate<T> inputConstraint, final boolean failOnInputConstraintViolation) {
+            @Nonnull final java.util.function.Predicate<T> inputConstraint,
+            final boolean failOnInputConstraintViolation) {
         preprocessor = Constraint.isNotNull(inputPreprocessor, "Input preprocessor can not be null");
         constraint = Constraint.isNotNull(inputConstraint, "Input constraint can not be null");
         failOnConstraintViolation = failOnInputConstraintViolation;
@@ -65,7 +66,7 @@ public class TransformAndCheckFunction<T> implements Function<T, Optional<? exte
     public Optional<? extends T> apply(final T input) {
         final T processedValue = preprocessor.apply(input);
 
-        final boolean meetsCriteria = constraint.apply(processedValue);
+        final boolean meetsCriteria = constraint.test(processedValue);
 
         if (meetsCriteria) {
             return Optional.of(processedValue);
@@ -100,7 +101,7 @@ public class TransformAndCheckFunction<T> implements Function<T, Optional<? exte
 
     /** {@inheritDoc} */
     public int hashCode() {
-        return Objects.hashCode(preprocessor, constraint, failOnConstraintViolation);
+        return Objects.hash(preprocessor, constraint, failOnConstraintViolation);
     }
 
     /** {@inheritDoc} */
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/TrimOrNullStringFunction.java b/src/main/java/net/shibboleth/utilities/java/support/logic/TrimOrNullStringFunction.java
index 12c80ad..5dd51c4 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/TrimOrNullStringFunction.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/TrimOrNullStringFunction.java
@@ -17,6 +17,8 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
+import java.util.function.Function;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
@@ -24,7 +26,6 @@ import javax.annotation.concurrent.ThreadSafe;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
-import com.google.common.base.Function;
 import com.google.common.base.MoreObjects;
 
 /** A {@link Function} that applies {@link StringSupport#trimOrNull(String)} to a given input string. */
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/DynamicResponseHeaderFilter.java b/src/main/java/net/shibboleth/utilities/java/support/net/DynamicResponseHeaderFilter.java
index 1f69640..738fa83 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/DynamicResponseHeaderFilter.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/DynamicResponseHeaderFilter.java
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.function.Function;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -38,7 +39,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
 
-import com.google.common.base.Function;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Collections2;
 
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/MediaTypeSupport.java b/src/main/java/net/shibboleth/utilities/java/support/net/MediaTypeSupport.java
index 1c59b41..4c74ff6 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/MediaTypeSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/MediaTypeSupport.java
@@ -19,8 +19,8 @@ package net.shibboleth.utilities.java.support.net;
 
 import java.util.HashSet;
 import java.util.Set;
+import java.util.function.Function;
 
-import com.google.common.base.Function;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Collections2;
 import com.google.common.net.MediaType;
@@ -33,7 +33,7 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
 public final class MediaTypeSupport {
     
     /** Function to strip MediaType parameters. */
-    private static final Function<MediaType, MediaType> STRIP_PARAMS = new StripMediaTypeParametersFunction();
+    private static final Function<MediaType,MediaType> STRIP_PARAMS = new StripMediaTypeParametersFunction();
     
     /** * Constructor. */
     private MediaTypeSupport() { }
@@ -81,7 +81,7 @@ public final class MediaTypeSupport {
                 final MediaType mediaType = MediaType.parse(contentTypeValue).withoutParameters();
                 final Set<MediaType> validTypesWithoutParameters = new HashSet<>();
                 validTypesWithoutParameters.addAll(Collections2.filter(
-                        Collections2.transform(validTypes, STRIP_PARAMS), 
+                        Collections2.transform(validTypes, STRIP_PARAMS::apply), 
                         Predicates.notNull()));
                 return validTypesWithoutParameters.contains(mediaType);
             }
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/StripMediaTypeParametersFunction.java b/src/main/java/net/shibboleth/utilities/java/support/net/StripMediaTypeParametersFunction.java
index c9e3ad5..8e8f476 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/StripMediaTypeParametersFunction.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/StripMediaTypeParametersFunction.java
@@ -17,7 +17,10 @@
 
 package net.shibboleth.utilities.java.support.net;
 
-import com.google.common.base.Function;
+import java.util.function.Function;
+
+import javax.annotation.Nullable;
+
 import com.google.common.net.MediaType;
 
 /**
@@ -26,7 +29,7 @@ import com.google.common.net.MediaType;
 public class StripMediaTypeParametersFunction implements Function<MediaType, MediaType> {
 
     /** {@inheritDoc} */
-    public MediaType apply(final MediaType input) {
+    @Nullable public MediaType apply(@Nullable final MediaType input) {
         if (input == null) {
             return null;
         } else {
diff --git a/src/main/java/net/shibboleth/utilities/java/support/primitive/StringSupport.java b/src/main/java/net/shibboleth/utilities/java/support/primitive/StringSupport.java
index e6de6e4..7cca331 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/primitive/StringSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/primitive/StringSupport.java
@@ -178,7 +178,7 @@ public final class StringSupport {
             return Collections.emptySet();
         }
         
-        return Collections2.filter(Collections2.transform(values, TrimOrNullStringFunction.INSTANCE),
+        return Collections2.filter(Collections2.transform(values, TrimOrNullStringFunction.INSTANCE::apply),
                 Predicates.notNull());
     }
 }
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistry.java b/src/main/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistry.java
index 17faf35..e126915 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistry.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistry.java
@@ -24,6 +24,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
+import java.util.function.Predicate;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -34,8 +35,6 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Predicate;
-
 /**
  * A registry which manages mappings from types of {@link Criterion} to types of {@link Predicate}
  * which can evaluate that criterion's data against a particular target type.
@@ -51,10 +50,10 @@ import com.google.common.base.Predicate;
 public class CriterionPredicateRegistry<T> {
 
     /** Logger. */
-    private Logger log = LoggerFactory.getLogger(CriterionPredicateRegistry.class);
+    @Nonnull private Logger log = LoggerFactory.getLogger(CriterionPredicateRegistry.class);
 
     /** Storage for the registry mappings. */
-    private Map<Class<? extends Criterion>, Class<? extends Predicate<T>>> registry;
+    @Nonnull private Map<Class<? extends Criterion>, Class<? extends Predicate<T>>> registry;
     
     /** Constructor. */
     public CriterionPredicateRegistry() {
diff --git a/src/main/java/net/shibboleth/utilities/java/support/resolver/ResolverSupport.java b/src/main/java/net/shibboleth/utilities/java/support/resolver/ResolverSupport.java
index d05bde7..dbd10ec 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/resolver/ResolverSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/resolver/ResolverSupport.java
@@ -20,14 +20,15 @@ package net.shibboleth.utilities.java.support.resolver;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.function.Predicate;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
 import com.google.common.collect.Iterables;
 
+import net.shibboleth.utilities.java.support.logic.PredicateSupport;
+
 /**
  * Support class for resolver implementations.
  */
@@ -108,13 +109,12 @@ public final class ResolverSupport {
         
         final Predicate<T> predicate;
         if (satisfyAny) {
-            predicate = Predicates.or(predicates);
+            predicate = PredicateSupport.or(predicates);
         } else {
-            predicate = Predicates.and(predicates);
+            predicate = PredicateSupport.and(predicates);
         }
         
-        return Iterables.filter(candidates, predicate);
+        return Iterables.filter(candidates, predicate::test);
     }
     
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java b/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
index 862beee..60f6fd6 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
@@ -20,6 +20,7 @@ package net.shibboleth.utilities.java.support.velocity;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.nio.charset.Charset;
+import java.util.Objects;
 import java.util.UUID;
 
 import javax.annotation.Nonnull;
@@ -37,7 +38,6 @@ import org.apache.velocity.runtime.resource.util.StringResourceRepository;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
 
 /**
  * This is a helper class that wraps a velocity engine and template information into a single object. It provides
@@ -55,13 +55,13 @@ import com.google.common.base.Objects;
 public final class Template {
 
     /** The {@link VelocityEngine} used when evaluating the template. */
-    private final VelocityEngine engine;
+    @Nonnull private final VelocityEngine engine;
 
     /** The name of the template to be evaluated. */
-    private final String templateName;
+    @Nonnull @NotEmpty private final String templateName;
 
     /** The character encoding of the template. */
-    private final String templateEncoding;
+    @Nonnull @NotEmpty private final String templateEncoding;
 
     /**
      * Constructor.
@@ -259,7 +259,7 @@ public final class Template {
 
     /** {@inheritDoc} */
     @Override public int hashCode() {
-        return Objects.hashCode(engine, templateName);
+        return Objects.hash(engine, templateName);
     }
 
     /** {@inheritDoc} */
diff --git a/src/test/java/net/shibboleth/utilities/java/support/collection/CollectionTest.java b/src/test/java/net/shibboleth/utilities/java/support/collection/CollectionTest.java
index 2c64006..d62226d 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/collection/CollectionTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/collection/CollectionTest.java
@@ -21,13 +21,13 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.function.Function;
 
 import net.shibboleth.utilities.java.support.logic.TransformAndCheckFunction;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Function;
 import com.google.common.base.Functions;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicates;
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicateTest.java b/src/test/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicateTest.java
index ea36288..b62c868 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicateTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicateTest.java
@@ -31,27 +31,27 @@ public class AllMatchPredicateTest {
     @Test public void testApply() {
         AllMatchPredicate<String> predicate = new AllMatchPredicate<>(Predicates.equalTo("foo"));
 
-        if (predicate.apply(null)) {
+        if (predicate.test(null)) {
             Assert.fail();
         }
 
-        if (predicate.apply(Collections.EMPTY_LIST)) {
+        if (predicate.test(Collections.EMPTY_LIST)) {
             Assert.fail();
         }
 
-        if (!predicate.apply(Collections.singletonList("foo"))) {
+        if (!predicate.test(Collections.singletonList("foo"))) {
             Assert.fail();
         }
 
-        if (!predicate.apply(Arrays.asList("foo", "foo"))) {
+        if (!predicate.test(Arrays.asList("foo", "foo"))) {
             Assert.fail();
         }
 
-        if (predicate.apply(Arrays.asList("foo", "bar", "foo"))) {
+        if (predicate.test(Arrays.asList("foo", "bar", "foo"))) {
             Assert.fail();
         }
         
-        if (predicate.apply(Arrays.asList("bar", "baz"))) {
+        if (predicate.test(Arrays.asList("bar", "baz"))) {
             Assert.fail();
         }
     }
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicateTest.java b/src/test/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicateTest.java
index 41bcc0d..c0c3fb6 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicateTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicateTest.java
@@ -31,27 +31,27 @@ public class AnyMatchPredicateTest {
     @Test public void testApply(){
         AnyMatchPredicate<String> predicate = new AnyMatchPredicate<>(Predicates.equalTo("foo"));
         
-        if (predicate.apply(null)) {
+        if (predicate.test(null)) {
             Assert.fail();
         }
 
-        if (predicate.apply(Collections.EMPTY_LIST)) {
+        if (predicate.test(Collections.EMPTY_LIST)) {
             Assert.fail();
         }
 
-        if (!predicate.apply(Collections.singletonList("foo"))) {
+        if (!predicate.test(Collections.singletonList("foo"))) {
             Assert.fail();
         }
 
-        if (!predicate.apply(Arrays.asList("foo", "foo"))) {
+        if (!predicate.test(Arrays.asList("foo", "foo"))) {
             Assert.fail();
         }
 
-        if (!predicate.apply(Arrays.asList("foo", "bar", "foo"))) {
+        if (!predicate.test(Arrays.asList("foo", "bar", "foo"))) {
             Assert.fail();
         }
         
-        if (predicate.apply(Arrays.asList("bar", "baz"))) {
+        if (predicate.test(Arrays.asList("bar", "baz"))) {
             Assert.fail();
         }
     }
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicateTest.java b/src/test/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicateTest.java
index 9ecc3e0..4e8821c 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicateTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicateTest.java
@@ -26,27 +26,27 @@ public class CaseInsensitiveStringMatchPredicateTest {
     @Test public void testApply(){
         CaseInsensitiveStringMatchPredicate predicate = new CaseInsensitiveStringMatchPredicate("FoO");
         
-        if(predicate.apply(null)){
+        if(predicate.test(null)){
             Assert.fail();
         }
         
-        if(predicate.apply("")){
+        if(predicate.test("")){
             Assert.fail();
         }
         
-        if(predicate.apply("  ")){
+        if(predicate.test("  ")){
             Assert.fail();
         }
         
-        if(!predicate.apply("foo")){
+        if(!predicate.test("foo")){
             Assert.fail();
         }
         
-        if(!predicate.apply("FOO")){
+        if(!predicate.test("FOO")){
             Assert.fail();
         }
         
-        if(predicate.apply("bar")){
+        if(predicate.test("bar")){
             Assert.fail();
         }
     }
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionFunction.java b/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionFunction.java
index e2a2cc1..37ed6a4 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionFunction.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionFunction.java
@@ -17,11 +17,11 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
+import java.util.function.Function;
+
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.InitializableComponent;
 
-import com.google.common.base.Function;
-
 /**
  * A {@link Function} that always throws a {@link ComponentInitializationException} when {@link #initialize()} is
  * called.
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionPredicate.java b/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionPredicate.java
index 18c2d1d..7020096 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionPredicate.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/ComponentInitializationExceptionPredicate.java
@@ -20,8 +20,6 @@ package net.shibboleth.utilities.java.support.logic;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.InitializableComponent;
 
-import com.google.common.base.Predicate;
-
 /**
  * A {@link Predicate} that always throws a {@link ComponentInitializationException} when {@link #initialize()} is
  * called.
@@ -29,7 +27,7 @@ import com.google.common.base.Predicate;
 public class ComponentInitializationExceptionPredicate implements InitializableComponent, Predicate {
 
     /** {@inheritDoc} */
-    public boolean apply(Object arg0) {
+    public boolean test(Object arg0) {
         return false;
     }
 
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionFunction.java b/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionFunction.java
index 0051b4b..225e759 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionFunction.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionFunction.java
@@ -17,9 +17,9 @@
 
 package net.shibboleth.utilities.java.support.logic;
 
-import javax.annotation.Nonnull;
+import java.util.function.Function;
 
-import com.google.common.base.Function;
+import javax.annotation.Nonnull;
 
 /** A {@link Function} that always throws a {@link RuntimeException} of some sort. */
 public class ExceptionFunction implements Function {
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionPredicate.java b/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionPredicate.java
index 41cee75..5ff0aeb 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionPredicate.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/ExceptionPredicate.java
@@ -19,8 +19,6 @@ package net.shibboleth.utilities.java.support.logic;
 
 import javax.annotation.Nonnull;
 
-import com.google.common.base.Predicate;
-
 /** A {@link Predicate} that always throws a {@link RuntimeException} of some sort. */
 public class ExceptionPredicate implements Predicate<Object> {
 
@@ -37,7 +35,7 @@ public class ExceptionPredicate implements Predicate<Object> {
     }
 
     /** {@inheritDoc} */
-    public boolean apply(Object arg0) {
+    public boolean test(Object arg0) {
         throw thrownException;
     }
 }
\ No newline at end of file
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/ScriptedTest.java b/src/test/java/net/shibboleth/utilities/java/support/logic/ScriptedTest.java
index 7d24381..8ecb66b 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/ScriptedTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/ScriptedTest.java
@@ -36,11 +36,11 @@ public class ScriptedTest {
 
         ScriptedPredicate test = ScriptedPredicate.inlineScript(returnSelf);
 
-        Assert.assertTrue(test.apply(Boolean.TRUE));
-        Assert.assertFalse(test.apply(Boolean.FALSE));
-        Assert.assertFalse(test.apply(Integer.valueOf(1)));
+        Assert.assertTrue(test.test(Boolean.TRUE));
+        Assert.assertFalse(test.test(Boolean.FALSE));
+        Assert.assertFalse(test.test(Integer.valueOf(1)));
         test.setReturnOnError(true);
-        Assert.assertTrue(test.apply(Integer.valueOf(1)));
+        Assert.assertTrue(test.test(Integer.valueOf(1)));
     }
 
     @Test public void testPredicateCustom() throws ScriptException {
@@ -48,13 +48,13 @@ public class ScriptedTest {
         ScriptedPredicate test = ScriptedPredicate.inlineScript(returnCustom);
 
         test.setCustomObject(Boolean.TRUE);
-        Assert.assertTrue(test.apply(Boolean.FALSE));
+        Assert.assertTrue(test.test(Boolean.FALSE));
         test.setCustomObject(Boolean.FALSE);
-        Assert.assertFalse(test.apply(Boolean.TRUE));
+        Assert.assertFalse(test.test(Boolean.TRUE));
         test.setCustomObject(Integer.valueOf(1));
-        Assert.assertFalse(test.apply("true"));
+        Assert.assertFalse(test.test("true"));
         test.setReturnOnError(true);
-        Assert.assertTrue(test.apply("false"));
+        Assert.assertTrue(test.test("false"));
     }
 
     @Test public void testBadScriptPredicate() throws ScriptException {
@@ -63,13 +63,13 @@ public class ScriptedTest {
 
         test.setHideExceptions(true);
         test.setReturnOnError(true);
-        Assert.assertTrue(test.apply(null));
+        Assert.assertTrue(test.test(null));
         test.setReturnOnError(false);
-        Assert.assertFalse(test.apply(null));
+        Assert.assertFalse(test.test(null));
 
         test.setHideExceptions(false);
         try {
-            Assert.assertFalse(test.apply(null));
+            Assert.assertFalse(test.test(null));
             Assert.fail();
         } catch (final RuntimeException e) {
             Assert.assertEquals(e.getCause().getClass(), ScriptException.class);
diff --git a/src/test/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunctionTest.java b/src/test/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunctionTest.java
index c643332..bd7f737 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunctionTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/logic/TransformAndCheckFunctionTest.java
@@ -19,12 +19,11 @@ package net.shibboleth.utilities.java.support.logic;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.function.Function;
 
 import org.testng.annotations.Test;
 
-import com.google.common.base.Function;
 import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
 
 /**
  * Test for {@link TransformAndCheckFunction}.
@@ -38,7 +37,7 @@ public class TransformAndCheckFunctionTest {
         boolean thrown = false;
         try {
             f = new TransformAndCheckFunction<>(nullValue(), new MyPredicate(), true);
-        } catch (ConstraintViolationException e) {
+        } catch (final ConstraintViolationException e) {
             thrown = true;
         }
         org.testng.Assert.assertTrue(thrown, "Null function should throw");
@@ -46,14 +45,14 @@ public class TransformAndCheckFunctionTest {
         thrown = false;
         try {
             f = new TransformAndCheckFunction<>(TrimOrNullStringFunction.INSTANCE, nullValue(), true);
-        } catch (ConstraintViolationException e) {
+        } catch (final ConstraintViolationException e) {
             thrown = true;
         }
         org.testng.Assert.assertTrue(thrown, "Null predicate should throw");
         org.testng.Assert.assertNull(f, "silence compiler warning");
     }
 
-    @Test public void testApply() {
+    @Test(expectedExceptions=IllegalArgumentException.class) public void testApply() {
         Function<String, Optional<? extends String>> f =
                 new TransformAndCheckFunction<>(TrimOrNullStringFunction.INSTANCE, new MyPredicate(), false);
 
@@ -62,13 +61,7 @@ public class TransformAndCheckFunctionTest {
 
         f = new TransformAndCheckFunction<>(TrimOrNullStringFunction.INSTANCE, new MyPredicate(), true);
         org.testng.Assert.assertEquals(f.apply(" iii ").get(), "iii", "present and trimmed");
-        boolean thrown = false;
-        try {
-            f.apply(" two");
-        } catch (IllegalArgumentException e) {
-            thrown = true;
-        }
-        org.testng.Assert.assertTrue(thrown, "mismatch should throw");
+        f.apply(" two");
     }
 
     private <T> T nullValue() {
@@ -77,7 +70,7 @@ public class TransformAndCheckFunctionTest {
     
     private class MyPredicate implements Predicate<String> {
         /** {@inheritDoc} */
-        public boolean apply(String input) {
+        public boolean test(String input) {
             for (String s : excludes) {
                 if (s.equals(input)) {
                     return true;
diff --git a/src/test/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistryTest.java b/src/test/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistryTest.java
index f19c4f1..9748c61 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistryTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/resolver/CriterionPredicateRegistryTest.java
@@ -20,13 +20,12 @@ package net.shibboleth.utilities.java.support.resolver;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
+import java.util.function.Predicate;
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicate;
-
 public class CriterionPredicateRegistryTest {
     
     private TestCriterion fooCriterion;
diff --git a/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableFooCriterion.java b/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableFooCriterion.java
index 4296f7f..5dcd1cb 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableFooCriterion.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableFooCriterion.java
@@ -17,7 +17,7 @@
 
 package net.shibboleth.utilities.java.support.resolver;
 
-import com.google.common.base.Predicate;
+import java.util.function.Predicate;
 
 /**
  *
diff --git a/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableTestFooCriterion.java b/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableTestFooCriterion.java
index 8296e57..15b6289 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableTestFooCriterion.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/resolver/EvaluableTestFooCriterion.java
@@ -29,7 +29,7 @@ public class EvaluableTestFooCriterion implements EvaluableFooCriterion {
         result = flag;
     }
 
-    public boolean apply(Foo input) {
+    public boolean test(Foo input) {
         return result;
     }
 
diff --git a/src/test/java/net/shibboleth/utilities/java/support/resolver/FooPredicate.java b/src/test/java/net/shibboleth/utilities/java/support/resolver/FooPredicate.java
index 0a093da..9a6a62e 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/resolver/FooPredicate.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/resolver/FooPredicate.java
@@ -17,7 +17,7 @@
 
 package net.shibboleth.utilities.java.support.resolver;
 
-import com.google.common.base.Predicate;
+import java.util.function.Predicate;
 
 /**
  *
@@ -28,7 +28,7 @@ public class FooPredicate implements Predicate<Foo> {
         // just a mock class
     }
 
-    public boolean apply(Foo input) {
+    public boolean test(Foo input) {
         return true;
     }
 
diff --git a/src/test/java/net/shibboleth/utilities/java/support/resolver/ResolverSupportTest.java b/src/test/java/net/shibboleth/utilities/java/support/resolver/ResolverSupportTest.java
index 6a2b18a..e6f7bbe 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/resolver/ResolverSupportTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/resolver/ResolverSupportTest.java
@@ -18,11 +18,11 @@
 package net.shibboleth.utilities.java.support.resolver;
 
 import java.util.Set;
+import java.util.function.Predicate;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicate;
 import com.google.common.collect.Sets;
 
 public class ResolverSupportTest {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list