|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.factorymethod.Main
public class Main
Factory Method tests.
Constructor Summary | |
---|---|
Main()
No-arg constructor. |
Method Summary | ||
---|---|---|
static void |
main(String[] args)
Executes the Factory Method tests. |
|
boolean |
test(Log out,
Arguments arguments)
Performs the specific tests and report the outcome to the log supplied as log . |
|
private static
|
testCreator(Log out,
CommandCreator<E,T> creator,
Sequence<E> sequence,
int index,
List<T> tokens)
Tests the creator supplied as creator using sequence
for each token in tokens |
|
private static
|
testFactory(Log out,
Sequence<E> sequence,
int index,
List<Factory<? extends Command<E>>> factories)
Tests the factories supplied in factories that creates commands
based on sequence as the single argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Main()
Method Detail |
---|
public static void main(String[] args) throws Exception
args
- The arguments to supply to test(Log, Arguments)
,
if any; can be null.
Exception
- If the test failed unexpectedly.public boolean test(Log out, Arguments arguments) throws Exception
Testable
log
supplied as log
. Arguments to control log-level:
-log
: a boolean value (as a string) indicating if
class logging is enabled for relevant classes.
-log.verbose
: a boolean value (as a string) indicating
if class logging is enabled for relevant classes that generates
verbose output.
test
in interface Testable
out
- The log to report the test outcome to; cannot be null.arguments
- Additional arguments, if any.
NullPointerException
- If out
is null.
Exception
- In case an unexpected error occurs.private static final <E,T> boolean testCreator(Log out, CommandCreator<E,T> creator, Sequence<E> sequence, int index, List<T> tokens)
creator
using sequence
for each token in tokens
E
- The type of sequence and command values.T
- The type of tokens used to identify the type of
command to create.out
- Log to use; never null.creator
- The creator to test; never null.sequence
- The sequence to use; never null.index
- The index of the sequence among all sequences tested.tokens
- The tokens to identify the types of commands
to create.
private static final <E> boolean testFactory(Log out, Sequence<E> sequence, int index, List<Factory<? extends Command<E>>> factories)
factories
that creates commands
based on sequence
as the single argument.
E
- The type of sequence and command values.out
- Log to use; never null.sequence
- The sequence to use; never null.index
- The index of the sequence among all sequences tested.factories
- The factories to create the commands using
sequence
as the argument.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |