net.java.quickcheck.characteristic
Class AbstractCharacteristic<T>

java.lang.Object
  extended by net.java.quickcheck.characteristic.AbstractCharacteristic<T>
Type Parameters:
T - Type of generated random test instances.
All Implemented Interfaces:
Characteristic<T>

public abstract class AbstractCharacteristic<T>
extends Object
implements Characteristic<T>

AbstractCharacteristic is an implementation of Characteristic with Classification handling. The methods classify(Object) and classify(boolean, Object) can be used to classify test data.


Constructor Summary
AbstractCharacteristic()
           
AbstractCharacteristic(String name)
           
 
Method Summary
protected  void classify(boolean predicate, Object classification)
          Add a classification with the given key if the predicate is true.
protected  void classify(Object classification)
          Add a classification with the given key.
protected abstract  void doSpecify(T any)
          Implement this method to specify the characteristic (Characteristic.specify(Object)).
 Classification getClassification()
          Classification data about the test cases executed.
 String name()
          Unique name for this characteristic instance.
 void setUp()
          Set up operation before Characteristic.specify(Object) is executed.
 void specify(T any)
          Checks the characteristic's specification for a test case instance.
 void tearDown()
          Clean up operation after Characteristic.specify(Object) was executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCharacteristic

public AbstractCharacteristic()

AbstractCharacteristic

public AbstractCharacteristic(String name)
Method Detail

specify

public void specify(T any)
             throws Throwable
Checks the characteristic's specification for a test case instance. specify(Object) will call doSpecify(Object).

Specified by:
specify in interface Characteristic<T>
Parameters:
any - for which to check the characteristic
Throws:
Throwable - if the instance does not confirm to the characteristic's specification

classify

protected void classify(boolean predicate,
                        Object classification)
Add a classification with the given key if the predicate is true.

Parameters:
classification - classification key.

classify

protected void classify(Object classification)
Add a classification with the given key.

Parameters:
classification - classification key.

doSpecify

protected abstract void doSpecify(T any)
                           throws Throwable
Implement this method to specify the characteristic (Characteristic.specify(Object)).

Throws:
Throwable

getClassification

public Classification getClassification()
Classification data about the test cases executed.


setUp

public void setUp()
           throws Exception
Set up operation before Characteristic.specify(Object) is executed.

Specified by:
setUp in interface Characteristic<T>
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Clean up operation after Characteristic.specify(Object) was executed.

Specified by:
tearDown in interface Characteristic<T>
Throws:
Exception

name

public String name()
Description copied from interface: Characteristic
Unique name for this characteristic instance.

Specified by:
name in interface Characteristic<T>
Returns:
name of the characteristic.


Copyright © 2011. All Rights Reserved.