Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.meta.test
Class IntegrityTests

java.lang.Object
  extended by dk.rode.thesis.meta.test.IntegrityTests
All Implemented Interfaces:
Testable

public class IntegrityTests
extends Object
implements Testable

Sequence integrity tests.

Author:
Gunni Rode / rode.dk

Constructor Summary
IntegrityTests()
           
 
Method Summary
static void main(String[] args)
          Executes the sequence integrity tests.
 boolean test(Log out, Arguments arguments)
          Performs the specific tests and report the outcome to the log supplied as log.
private
<E> boolean
test(Log out, boolean log, int index, Sequence<E> sequence, int iterations, int maxErrors)
          Performs an integrity test of the Sequence supplied as sequence, and returns true upon success or false if the test failed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegrityTests

public IntegrityTests()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Executes the sequence integrity tests.

Parameters:
args - The arguments to supply to test(Log, Arguments), if any; can be null.
Throws:
Exception - If the sequence integrity tests fail.

test

public boolean test(Log out,
                    Arguments arguments)
             throws Exception
Description copied from interface: Testable
Performs the specific tests and report the outcome to the log supplied as log.

Arguments to control log-level:

Specified by:
test in interface Testable
Parameters:
out - The log to report the test outcome to; cannot be null.
arguments - Additional arguments, if any.
Returns:
True if the tests succeeded, false if not.
Throws:
NullPointerException - If out is null.
Exception - In case an unexpected error occurs.

test

private <E> boolean test(Log out,
                         boolean log,
                         int index,
                         Sequence<E> sequence,
                         int iterations,
                         int maxErrors)
Performs an integrity test of the Sequence supplied as sequence, and returns true upon success or false if the test failed.

Type Parameters:
E - The type of values delivered by sequence.
Parameters:
out - The log to use; never null.
log - True to enable verbose logging for the type of sequence.
index - The index of sequence among all tested sequence instances.
sequence - The sequence to test; never null.
iterations - Number of times to invoke next() on sequence.
maxErrors - Maximum number of allowed errors before bailing out of the test.
Returns:
True if the test succeeded, false if it failed.

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.