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

dk.rode.thesis.command
Class Main

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

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

Command tests.

Author:
Gunni Rode / rode.dk

Constructor Summary
Main()
          No-arg constructor.
 
Method Summary
private static
<E> boolean
doTest(Log out, int index, Sequence<E> s, Creator creator, Boolean fail, boolean copy)
          Executes a given command test for a given sequence.
static void main(String[] args)
          Executes the Command tests.
 boolean test(Log out, Arguments arguments)
          Performs the specific tests and report the outcome to the log supplied as log.
private static boolean test(Log out, String heading, Sequence<?>[] sequences, Creator creator, Boolean fail, boolean copy)
          Executes a given command test for all sequences.
private static
<E> List<Command<E>>
test1(Log out, Sequence<E> sequence, Boolean fail)
          Creates command for the first composite test.
private static
<E> List<Command<E>>
test2(Log out, Sequence<E> sequence, Boolean fail)
          Creates command for the second composite test.
 
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

doTest

private static final <E> boolean doTest(Log out,
                                        int index,
                                        Sequence<E> s,
                                        Creator creator,
                                        Boolean fail,
                                        boolean copy)
Executes a given command test for a given sequence.

Type Parameters:
E - The type of values delivered by s.
Parameters:
out - The log to use; never null.
index - The index of sequence.
s - The sequence to use; never null.
creator - The creator used to create and supply the commands to test; never null.
fail - Flag to determine if the test is supposed to fail or not.
copy - True if the sequences should be copied before use, false if not.
Returns:
True on success.

main

public static void main(String[] args)
Executes the Command 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.

test

private static final boolean test(Log out,
                                  String heading,
                                  Sequence<?>[] sequences,
                                  Creator creator,
                                  Boolean fail,
                                  boolean copy)
Executes a given command test for all sequences.

Parameters:
out - The log to use; never null.
heading - Title of the test; never null.
sequences - The sequences to use; never null.
creator - The creator used to create and supply the commands to test; never null.
fail - Flag to determine if the test is supposed to fail or not.
copy - True if the sequences should be copied before use, false if not.
Returns:
True on success.

test1

private static final <E> List<Command<E>> test1(Log out,
                                                Sequence<E> sequence,
                                                Boolean fail)
Creates command for the first composite test.

Type Parameters:
E - The type of values delivered by sequence.
Parameters:
out - The log to use; never null.
sequence - The sequence to use; never null.
fail - Flag to determine if the test is supposed to fail or not.
Returns:
The created commands; never null.

test2

private static final <E> List<Command<E>> test2(Log out,
                                                Sequence<E> sequence,
                                                Boolean fail)
Creates command for the second composite test.

Type Parameters:
E - The type of values delivered by sequence.
Parameters:
out - The log to use; never null.
sequence - The sequence to use; never null.
fail - Flag to determine if the test is supposed to fail or not.
Returns:
The created commands; 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.