@ParametersAreNonnullByDefault
Package com.google.common.testing
This package contains testing utilities. It is a part of the open-source Guava library.
-
Interface Summary Interface Description GcFinalization.FinalizationPredicate A predicate that is expected to return true subsequent to finalization, that is, one of the following actions taken by the garbage collector when performing a full collection in response toSystem.gc()
: invoking thefinalize
methods of unreachable objects clearing weak references to unreachable referents enqueuing weak references to unreachable referents in their reference queueTearDown An object that can perform aTearDown.tearDown()
operation.TearDownAccepter Any object which can accept registrations ofTearDown
instances. -
Class Summary Class Description AbstractPackageSanityTests Automatically runs sanity checks against top level classes in the same package of the test that extendsAbstractPackageSanityTests
.AbstractPackageSanityTests.Chopper ArbitraryInstances Supplies an arbitrary "default" instance for a wide range of types, often useful in testing utilities.ArbitraryInstances.AlwaysEqual ArbitraryInstances.ByToString ArbitraryInstances.Dummies ArbitraryInstances.Dummies.DeterministicRandom ArbitraryInstances.Dummies.DummyCountDownLatch ArbitraryInstances.Dummies.DummyExecutor ArbitraryInstances.Dummies.DummyRunnable ArbitraryInstances.Dummies.DummyScheduledThreadPoolExecutor ArbitraryInstances.Dummies.DummyThreadFactory ArbitraryInstances.Dummies.InMemoryPrintStream ArbitraryInstances.Dummies.InMemoryPrintWriter ArbitraryInstances.NullByteSink ClassSanityTester Tester that runs automated sanity tests for any given class.ClassSanityTester.SerializableDummyProxy CollectorTester<T,A,R> Tester forCollector
implementations.DummyProxy Generates a dummy interface proxy that simply returns a dummy value for each method.EqualsTester Tester for equals() and hashCode() methods of a class.EquivalenceTester<T> Tester forEquivalence
relationships between groups of objects.FakeTicker A Ticker whose value can be advanced programmatically in test.ForwardingWrapperTester Tester to ensure forwarding wrapper works by delegating calls to the corresponding method with the same parameters forwarded and return value forwarded back or exception propagated as is.ForwardingWrapperTester.InteractionTester<T> Tests a single interaction against a method.FreshValueGenerator Generates fresh instances of types that are different from each other (if possible).GcFinalization Testing utilities relating to garbage collection finalization.NullPointerTester A test utility that verifies that your methods and constructors throwNullPointerException
orUnsupportedOperationException
whenever null is passed to a parameter whose declaration or type isn't annotated with an annotation with the simple nameNullable
, ,NullableType
, orNullableDecl
.NullPointerTester.Signature Platform Methods factored out so that they can be emulated differently in GWT.RelationshipTester<T> Implementation helper forEqualsTester
andEquivalenceTester
that tests for equivalence classes.RelationshipTester.Item<T> RelationshipTester.ItemReporter SerializableTester Tests serialization and deserialization of an object, optionally asserting that the resulting object is equal to the original.SloppyTearDown Simple utility for when you want to create aTearDown
that may throw an exception but should not fail a test when it does.TearDownStack ATearDownStack
contains a stack ofTearDown
instances.TestLogHandler Tests may use this to intercept messages that are logged by the code under test. -
Enum Summary Enum Description CollectorTester.CollectStrategy Different orderings for combining the elements of an input array, which must all produce the same result.EqualsTester.NotAnInstance Class used to test whether equals() correctly handles an instance of an incompatible class.NullPointerTester.ExceptionTypePolicy Strategy for exception type matching used byNullPointerTester
.NullPointerTester.Visibility Visibility of any method or constructor. -
Exception Summary Exception Description ClassSanityTester.FactoryMethodReturnsNullException Thrown if the test tries to invoke a static factory method to test instance methods but the factory returned null.ClassSanityTester.ParameterHasNoDistinctValueException Thrown if the test fails to generate two distinct non-null values of a constructor or factory parameter in order to testObject.equals(java.lang.Object)
andObject.hashCode()
of the declaring class.ClassSanityTester.ParameterNotInstantiableException Thrown if the test tries to invoke a constructor or static factory method but failed because the dummy value of a constructor or method parameter is unknown.ClusterException AnClusterException
is a data structure that allows for some code to "throw multiple exceptions", or something close to it. -
Annotation Types Summary Annotation Type Description FreshValueGenerator.Empty Annotates a method to generate the "empty" instance of a collection.FreshValueGenerator.Generates Annotates a method to be the instance generator of a certain type.