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

dk.rode.thesis.abstractfactory
Class Main

java.lang.Object
  extended by dk.rode.thesis.abstractfactory.Main
All Implemented Interfaces:
Testable

@Participant(value="Client")
public class Main
extends Object
implements Testable

Abstract Factory tests.

Author:
Gunni Rode / rode.dk

Constructor Summary
Main()
          No-arg constructor.
 
Method Summary
static void main(String[] args)
          Executes the Abstract Factory tests.
 boolean test(Log out, Arguments arguments)
          Performs the specific tests and report the outcome to the log supplied as log.
private static
<E> void
testAbstractionFactory(Log out, String index, AbstractionFactory<E> factory)
          Test abstraction factories.
private static
<E,P> void
testGeneratorFactory(Log out, String index, GeneratorFactory<E,P> factory, P argument)
          Test generator factories.
private static
<E,P> Sequence<E>
testSequenceFactory(Log out, String index, SequenceFactory<E,P> factory, P argument)
          Test sequence factories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
No-arg constructor.

Method Detail

main

public static void main(String[] args)
Executes the Abstract Factory tests.

Parameters:
args - The arguments to supply to test(Log, Arguments), if any; can be null.

test

public boolean test(Log out,
                    Arguments arguments)
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.

testAbstractionFactory

private static final <E> void testAbstractionFactory(Log out,
                                                     String index,
                                                     AbstractionFactory<E> factory)
Test abstraction factories.

Type Parameters:
E - The type of values generated by the created abstraction.
Parameters:
out - Log to use; never null.
index - The number of the test; never null.
factory - The factory to test; never null.

testGeneratorFactory

private static final <E,P> void testGeneratorFactory(Log out,
                                                     String index,
                                                     GeneratorFactory<E,P> factory,
                                                     P argument)
Test generator factories.

Type Parameters:
E - The type of values generated by the created generator.
P - The type of argument to use in the creation process.
Parameters:
out - Log to use; never null.
index - The number of the test; never null.
factory - The factory to test; never null.
argument - Argument used in the creation process, if any; can be null.

testSequenceFactory

private static final <E,P> Sequence<E> testSequenceFactory(Log out,
                                                           String index,
                                                           SequenceFactory<E,P> factory,
                                                           P argument)
Test sequence factories.

Type Parameters:
E - The type of values generated by the created sequence.
P - The type of argument to use in the creation process.
Parameters:
out - Log to use; never null.
index - The number of the test; never null.
factory - The factory to test; never null.
argument - Argument used in the creation process, if any; can be null.
Returns:
The created sequence; never null.

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.