public final class ClassSanityTester.FactoryMethodReturnValueTester
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<?> |
declaringClass |
private ImmutableList<Invokable<?,?>> |
factories |
private java.lang.String |
factoryMethodsDescription |
private java.util.Set<java.lang.String> |
packagesToTest |
private java.lang.Class<?> |
returnTypeToTest |
Modifier | Constructor and Description |
---|---|
private |
FactoryMethodReturnValueTester(java.lang.Class<?> declaringClass,
ImmutableList<Invokable<?,?>> factories,
java.lang.String factoryMethodsDescription) |
Modifier and Type | Method and Description |
---|---|
private ImmutableList<Invokable<?,?>> |
getFactoriesToTest() |
ClassSanityTester.FactoryMethodReturnValueTester |
testEquals()
Tests
Object.equals(java.lang.Object) and Object.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.FactoryMethodReturnValueTester |
testEqualsAndSerializable()
Runs equals and serialization test on the return values.
|
ClassSanityTester.FactoryMethodReturnValueTester |
testNulls()
Tests null checks against the instance methods of the return values, if any.
|
ClassSanityTester.FactoryMethodReturnValueTester |
testSerializable()
Runs serialization test on the return values of the static methods.
|
ClassSanityTester.FactoryMethodReturnValueTester |
thatReturn(java.lang.Class<?> returnType)
Specifies that only the methods that are declared to return
returnType or its subtype
are tested. |
private final java.util.Set<java.lang.String> packagesToTest
private final java.lang.Class<?> declaringClass
private final ImmutableList<Invokable<?,?>> factories
private final java.lang.String factoryMethodsDescription
private java.lang.Class<?> returnTypeToTest
private FactoryMethodReturnValueTester(java.lang.Class<?> declaringClass, ImmutableList<Invokable<?,?>> factories, java.lang.String factoryMethodsDescription)
public ClassSanityTester.FactoryMethodReturnValueTester thatReturn(java.lang.Class<?> returnType)
returnType
or its subtype
are tested.public ClassSanityTester.FactoryMethodReturnValueTester testNulls() throws java.lang.Exception
Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
java.lang.Exception
public ClassSanityTester.FactoryMethodReturnValueTester testEquals() throws java.lang.Exception
Object.equals(java.lang.Object)
and Object.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.
java.lang.Exception
public ClassSanityTester.FactoryMethodReturnValueTester testSerializable() throws java.lang.Exception
Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
java.lang.Exception
public ClassSanityTester.FactoryMethodReturnValueTester testEqualsAndSerializable() throws java.lang.Exception
Test fails if default value cannot be determined for a constructor or factory method parameter, or if the constructor or factory method throws exception.
java.lang.Exception
private ImmutableList<Invokable<?,?>> getFactoriesToTest()