|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectFactory<T>
A callback interface for the creation of objects that are typically under test by the framework.
This interface defines a contract, which must be met.
This contract can be asserted by using the ObjectFactory contract assertions
.
Although this contract mandates five (5) aspects, it is trivial to meet for a typical class.
The contract is:
newInstanceX()
must consistently return new instances.
(factory.newInstanceX() == factory.newInstanceX())
false
.
newInstanceY()
must consistently return new instances.
(factory.newInstanceY() == factory.newInstanceY())
false
.
newInstanceX()
must consistently return instances that are equal to each other.(factory.newInstanceX().equals(factory.newInstanceX())
true
.
newInstanceY()
must consistently return instances that are equal to each other.(factory.newInstanceY().equals(factory.newInstanceY())
true
.
newInstanceX()
must consistently return instances that are not equal to
instances that are returned by newInstanceY()
.(factory.newInstanceX().equals(factory.newInstanceY())
false
.
ObjectFactoryContract
Method Summary | |
---|---|
T |
newInstanceX()
Returns a new instance of a class, that is always equal on successive calls and never equal to objects returned by newInstanceY() . |
T |
newInstanceY()
Returns a new instance of a class, that is always equal on successive calls and never equal to objects returned by newInstanceX() . |
Method Detail |
---|
T newInstanceX()
newInstanceY()
.
newInstanceY()
.T newInstanceY()
newInstanceX()
.
newInstanceX()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |