|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.pdx.cs399J.grader.Tester
public class Tester
This class contains a number of helper methods for testing projects in CS399J.
| Constructor Summary | |
|---|---|
Tester(PrintWriter pw)
Creates a new Tester that sends its output to a
given PrintWriter. |
|
Tester(String id,
File logDir)
Creates a new Tester for a given student. |
|
| Method Summary | |
|---|---|
void |
cat(File file)
"Cats" a file to the log. |
void |
cp(File srcFile,
File destFile)
Copies one file to another. |
void |
executeMain(String className,
String[] args)
Executes the main method of the class with the given
name with the given arguments. |
Thread |
executeMainInThread(String className,
String[] args)
Executes the main method of the class with the given
name in its own thread. |
Object |
executeStatic(String className,
String methodName,
Class[] paramTypes,
Object[] params)
Executes a static method of a given name in a given class with a given set of parameters. |
Object |
executeStatic(String className,
String methodName,
Class[] paramTypes,
Object[] params,
boolean printBanner)
Executes a static method of a given name in a given class with a given set of parameters. |
void |
finalize()
Make sure we're done when this Tester gets garbage
collected. |
static void |
main(String[] args)
Load a class from a given directory |
static void |
main0(String[] args)
Old Test Program. |
static URL[] |
parseURLPath(String path)
Parses a file path and creates an array of URLs
representing each file on the path. |
void |
printBanner(String text,
char c)
Prints a line of text to the log file, centers it, around surrounds it with a given character. |
void |
println(Object o)
Prints a left justified line of text to the log file. |
void |
println(String text)
Prints a left justified line of text to the log file. |
void |
printlnCentered(String text)
Prints a line of text to the log file and centers it. |
void |
setURLs(URL[] urls)
Sets the URLs on which to search for students' classes |
boolean |
wait(int seconds)
Waits for a given number of seconds. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Tester(PrintWriter pw)
Tester that sends its output to a
given PrintWriter. This is useful when you want to
dump to the console. The "student's" id is
"writer".
public Tester(String id,
File logDir)
Tester for a given student. It will
create a log file in given directory.
id - The student's login idlogDir - Directory into which the log file is placed.| Method Detail |
|---|
public static URL[] parseURLPath(String path)
URLs
representing each file on the path.
public void setURLs(URL[] urls)
public Object executeStatic(String className,
String methodName,
Class[] paramTypes,
Object[] params)
public Object executeStatic(String className,
String methodName,
Class[] paramTypes,
Object[] params,
boolean printBanner)
printBanner - Do we print a banner message?
public Thread executeMainInThread(String className,
String[] args)
main method of the class with the given
name in its own thread.
Thread in which the main
method is running.public boolean wait(int seconds)
false
if the thread was interrupted.
public void executeMain(String className,
String[] args)
main method of the class with the given
name with the given arguments.
public void println(Object o)
public void println(String text)
public void printlnCentered(String text)
public void printBanner(String text,
char c)
public void cp(File srcFile,
File destFile)
public void cat(File file)
file - File to be cattedpublic void finalize()
Tester gets garbage
collected. This way, the stream will always get closed.
finalize in class Objectpublic static void main(String[] args)
public static void main0(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||