Package edu.pdx.cs.joy
Class InvokeMainTestCase
java.lang.Object
edu.pdx.cs.joy.InvokeMainTestCase
- Direct Known Subclasses:
BuildPhonebookTest,InvokeMainTest,MovieDatabaseRmiTestCase
The superclass of test classes that invoke a main method to test a Java program.
- Since:
- Summer 2010
- Author:
- David Whitlock
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classInvokes themainmethod of a class and captures information about the invocation such as the data written to standard out and standard error and the exit code. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InvokeMainTestCase.MainMethodResultinvokeMain(Class<?> mainClass, String... args) Invokes themainmethod of the given class with the given arguments and returns an object that represents the result of invoking that method.protected InvokeMainTestCase.MainMethodResultinvokeMainAllowingMutableStaticFields(Class<?> mainClass, String... args) Invokes themainmethod of the given class with the given arguments and returns an object that represents the result of invoking that method.
-
Constructor Details
-
InvokeMainTestCase
public InvokeMainTestCase()
-
-
Method Details
-
invokeMain
Invokes themainmethod of the given class with the given arguments and returns an object that represents the result of invoking that method.- Parameters:
mainClass- The class whose main method is invokedargs- The arguments passed to the main method- Returns:
- The result of the method invocation
-
invokeMainAllowingMutableStaticFields
protected InvokeMainTestCase.MainMethodResult invokeMainAllowingMutableStaticFields(Class<?> mainClass, String... args) Invokes themainmethod of the given class with the given arguments and returns an object that represents the result of invoking that method. This method will not throw aMainClassContainsMutableStaticFieldsexception if themainClasshas mutablestaticfields.- Parameters:
mainClass- The class whose main method is invokedargs- The arguments passed to the main method- Returns:
- The result of the method invocation
-