|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hyphenType.dynamicproxy.AbstractArgumentsInvocationHandler<T> org.hyphenType.unittesting.MockArgumentsInvocationHandler<T>
T
- The option interface type.public class MockArgumentsInvocationHandler<T extends Options<?>>
A mock to replace ConcreteArgumentsInvocationHandler
. When this class is used
instead of ConcreteArgumentsInvocationHandler
, this class avoids calls to
ArgumentsInvocationHandler#exit(Enum))
and
ArgumentsInvocationHandler#exit(int)))
to actually terminate the JVM.
Instead, this class will log those calls. This way, a unit test can read the
logs and determine if user source code is trying to terminate the JVM
correctly.
This class was designed to be utilized by UnitTestingOptionExtractor
.
UnitTestingOptionExtractor
,
ConcreteArgumentsInvocationHandler
Constructor Summary | |
---|---|
MockArgumentsInvocationHandler(OptionValues<T> values,
Class<? extends Options<?>> optionsInterface,
Class<? extends StatusCode> exitCodeEnumClass,
String[] rawArguments,
boolean throwsNonExceptionalExit)
Sole constructor. |
Method Summary | |
---|---|
protected void |
exit(Enum<?> e)
TODO Comment. |
protected void |
exit(int code)
TODO Comment. |
boolean |
exitEnumCalled()
Useful to check whether the exit(Enum) method was called or
not. |
boolean |
exitIntCalled()
Useful to check whether the exit(int) method was called or
not. |
Enum<?> |
getStatusCodeEnum()
Useful to analyze how the exit(Enum) method was called. |
int |
getStatusCodeInt()
Useful to analyze how the exit(int) method was called. |
Methods inherited from class org.hyphenType.dynamicproxy.AbstractArgumentsInvocationHandler |
---|
equals, hashCode, invoke, printDocumentation, printDocumentation, printDocumentation, printDocumentation, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MockArgumentsInvocationHandler(OptionValues<T> values, Class<? extends Options<?>> optionsInterface, Class<? extends StatusCode> exitCodeEnumClass, String[] rawArguments, boolean throwsNonExceptionalExit)
values
- The values parsed.formatter
- The documentation formatter.exitCodeEnumClass
- The enumeration class that will be used to exit.rawArguments
- The raw arguments "received" from the command line.throwsNonExceptionalExit
- Whether this mock implementation will throw the
NonExceptionalExit
exception or not.Method Detail |
---|
protected final void exit(Enum<?> e)
AbstractArgumentsInvocationHandler
exit
in class AbstractArgumentsInvocationHandler<T extends Options<?>>
e
- TODO Comment.protected final void exit(int code)
AbstractArgumentsInvocationHandler
exit
in class AbstractArgumentsInvocationHandler<T extends Options<?>>
code
- TODO Comment.public final Enum<?> getStatusCodeEnum()
exit(Enum)
method was called.
exit(Enum)
method.public final boolean exitEnumCalled()
exit(Enum)
method was called or
not.
exit(Enum)
was called or
not.public final int getStatusCodeInt()
exit(int)
method was called.
exit(int)
method.public final boolean exitIntCalled()
exit(int)
method was called or
not.
exit(int)
was called or
not.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |