Package com.google.common.testing
Class ClassSanityTester.FactoryMethodReturnValueTester
- java.lang.Object
-
- com.google.common.testing.ClassSanityTester.FactoryMethodReturnValueTester
-
- Enclosing class:
- ClassSanityTester
public final class ClassSanityTester.FactoryMethodReturnValueTester extends Object
Runs sanity tests against return values of static factory methods declared by a class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassSanityTester.FactoryMethodReturnValueTestertestEquals()TestsObject.equals(java.lang.Object)andObject.hashCode()against the return values of the static methods, by asserting that when equal parameters are passed to the same static method, the return value should also be equal; and vice versa.ClassSanityTester.FactoryMethodReturnValueTestertestEqualsAndSerializable()Runs equals and serialization test on the return values.ClassSanityTester.FactoryMethodReturnValueTestertestNulls()Tests null checks against the instance methods of the return values, if any.ClassSanityTester.FactoryMethodReturnValueTestertestSerializable()Runs serialization test on the return values of the static methods.ClassSanityTester.FactoryMethodReturnValueTesterthatReturn(Class<?> returnType)Specifies that only the methods that are declared to returnreturnTypeor its subtype are tested.
-
-
-
Method Detail
-
thatReturn
@CanIgnoreReturnValue public ClassSanityTester.FactoryMethodReturnValueTester thatReturn(Class<?> returnType)
Specifies that only the methods that are declared to returnreturnTypeor its subtype are tested.- Returns:
- this tester object
-
testNulls
@CanIgnoreReturnValue public ClassSanityTester.FactoryMethodReturnValueTester testNulls() throws Exception
Tests null checks against the instance methods of the return values, if any.Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
- Returns:
- this tester
- Throws:
Exception
-
testEquals
@CanIgnoreReturnValue public ClassSanityTester.FactoryMethodReturnValueTester testEquals() throws Exception
TestsObject.equals(java.lang.Object)andObject.hashCode()against the return values of the static methods, by asserting that when equal parameters are passed to the same static method, the return value should also be equal; and vice versa.Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
- Returns:
- this tester
- Throws:
Exception
-
testSerializable
@CanIgnoreReturnValue public ClassSanityTester.FactoryMethodReturnValueTester testSerializable() throws Exception
Runs serialization test on the return values of the static methods.Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
- Returns:
- this tester
- Throws:
Exception
-
testEqualsAndSerializable
@CanIgnoreReturnValue public ClassSanityTester.FactoryMethodReturnValueTester testEqualsAndSerializable() throws Exception
Runs equals and serialization test on the return values.Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
- Returns:
- this tester
- Throws:
Exception
-
-