org.jtiger.assertion
Interface ObjectFactory<T>


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:

  • The method newInstanceX() must consistently return new instances. (factory.newInstanceX() == factory.newInstanceX())
    must always evaluate to false.
  • The method newInstanceY() must consistently return new instances. (factory.newInstanceY() == factory.newInstanceY())
    must always evaluate to false.
  • The method newInstanceX() must consistently return instances that are equal to each other.
    (factory.newInstanceX().equals(factory.newInstanceX())
    must always evaluate to true.
  • The method newInstanceY() must consistently return instances that are equal to each other.
    (factory.newInstanceY().equals(factory.newInstanceY())
    must always evaluate to true.
  • The method newInstanceX() must consistently return instances that are not equal to instances that are returned by newInstanceY().
    (factory.newInstanceX().equals(factory.newInstanceY())
    must always evaluate to false.
  • Version:
    2.1
    Build Number 0376
    Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
    Author:
    Tony Morris
    See Also:
    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

    newInstanceX

    T newInstanceX()
    Returns a new instance of a class, that is always equal on successive calls and never equal to objects returned by newInstanceY().

    Returns:
    A new instance of a class, that is always equal on successive calls and never equal to objects returned by newInstanceY().

    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().

    Returns:
    A new instance of a class, that is always equal on successive calls and never equal to objects returned by newInstanceX().