Class FeatureUtil
java.lang.Object
com.google.common.collect.testing.features.FeatureUtil
Utilities for collecting and validating tester requirements from annotations.
- Author:
- George van den Driessche
-
Method Summary
Modifier and TypeMethodDescriptionaddImpliedFeatures
(Set<Feature<?>> features) Given a set of features, add to it all the features directly or indirectly implied by any of them, and return it.static TesterRequirements
buildDeclaredTesterRequirements
(AnnotatedElement classOrMethod) Construct the set of requirements specified by annotations directly on a tester class or method.static Iterable
<Annotation> getTesterAnnotations
(AnnotatedElement classOrMethod) Find all the tester annotations declared on a tester class or method.static TesterRequirements
getTesterRequirements
(Class<?> testerClass) Get the full set of requirements for a tester class.static TesterRequirements
getTesterRequirements
(Method testerMethod) Get the full set of requirements for a tester class.impliedFeatures
(Set<Feature<?>> features) Given a set of features, return a new set of all features directly or indirectly implied by any of them.static <T> Set
<T> intersection
(Set<? extends T> set1, Set<? extends T> set2) Deprecated.
-
Method Details
-
addImpliedFeatures
Given a set of features, add to it all the features directly or indirectly implied by any of them, and return it.- Parameters:
features
- the set of features to expand- Returns:
- the same set of features, expanded with all implied features
-
impliedFeatures
-
getTesterRequirements
public static TesterRequirements getTesterRequirements(Class<?> testerClass) throws ConflictingRequirementsException Get the full set of requirements for a tester class.- Parameters:
testerClass
- a tester class- Returns:
- all the constraints implicitly or explicitly required by the class or any of its superclasses.
- Throws:
ConflictingRequirementsException
- if the requirements are mutually inconsistent.
-
getTesterRequirements
public static TesterRequirements getTesterRequirements(Method testerMethod) throws ConflictingRequirementsException Get the full set of requirements for a tester class.- Parameters:
testerMethod
- a test method of a tester class- Returns:
- all the constraints implicitly or explicitly required by the method, its declaring class, or any of its superclasses.
- Throws:
ConflictingRequirementsException
- if the requirements are mutually inconsistent.
-
buildDeclaredTesterRequirements
public static TesterRequirements buildDeclaredTesterRequirements(AnnotatedElement classOrMethod) throws ConflictingRequirementsException Construct the set of requirements specified by annotations directly on a tester class or method.- Parameters:
classOrMethod
- a tester class or a test method thereof- Returns:
- all the constraints implicitly or explicitly required by annotations on the class or method.
- Throws:
ConflictingRequirementsException
- if the requirements are mutually inconsistent.
-
getTesterAnnotations
Find all the tester annotations declared on a tester class or method.- Parameters:
classOrMethod
- a class or method whose tester annotations to find- Returns:
- an iterable sequence of tester annotations on the class
-
intersection
Deprecated.UseSets.intersection(Set, Set)
instead.Construct a newSet
that is the intersection of the given sets.
-
Sets.intersection(Set, Set)
instead.