|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.testing.Utils
This class contains miscellaneous (static) utility functions that are useful in writing JUnit functional tests.
| Nested Class Summary | |
static class |
Utils.QuoteTokenizer
|
| Field Summary | |
(package private) static java.lang.String |
ORACLE_SUFFIX
|
private static java.io.PrintStream |
pse
A cached value of the usual System err stream. |
private static java.io.PrintStream |
pso
A cached value of the usual System out stream. |
(package private) static java.lang.String |
SAVED_SUFFIX
|
| Constructor Summary | |
Utils()
|
|
| Method Summary | |
static Diff |
compareStringToFile(java.lang.String s,
java.lang.String rootname)
Compares the given string to the content of the given file using a comparator that ignores platform differences in line-endings. |
static java.lang.String |
executeCompile(java.lang.Class cls,
java.lang.String[] args)
|
static java.lang.String |
executeMethod(java.lang.Class cls,
java.lang.String methodname,
java.lang.String[] args)
Finds and executes the method with the given name in the given class; the method must have a single argument of type String[]. |
static java.lang.String |
executeMethod(java.lang.reflect.Method method,
java.lang.String[] args)
Calls the given method on the given String[] argument. |
static java.util.ArrayList |
parseFoundLine(java.lang.String content,
java.lang.String filename)
Finds the first line with the given String in the given file and parses the content into tokens. |
static java.util.ArrayList |
parseResult(java.lang.String command)
Executes the given command as an external executable, reads the text produced and tokenizes it into Strings (separated by whitespace). |
static java.lang.String |
readFile(java.lang.String filename)
Reads the contents of the file with the given name, returning a String. |
static java.lang.String |
readFile(java.lang.String filename,
byte[] cb)
Reads the contents of the file with the given name, returning a String. |
static java.lang.String |
readFileX(java.lang.String filename)
|
static boolean |
recursivelyRemoveDirectory(java.io.File d,
boolean removeDirectoryItself)
Deletes the contents of a directory, including subdirectories. |
static void |
removeFiles(java.lang.String pattern)
This deletes all files (in the current directory) whose names match the given pattern in a regular-expression sense; however, it is only implemented for patterns consisting of characters and at most one '*', since I'm not going to rewrite an RE library. |
static void |
restoreStreams()
Restores System.out and System.err to the initial, system-defined values. |
static void |
setStreams(java.io.PrintStream ps)
Redirects System.out and System.err to the given PrintStream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.io.PrintStream pso
private static final java.io.PrintStream pse
static final java.lang.String ORACLE_SUFFIX
static final java.lang.String SAVED_SUFFIX
| Constructor Detail |
public Utils()
| Method Detail |
public static void setStreams(java.io.PrintStream ps)
public static void restoreStreams()
public static java.util.ArrayList parseResult(java.lang.String command)
throws java.io.IOException
java.io.IOException
public static java.util.ArrayList parseFoundLine(java.lang.String content,
java.lang.String filename)
throws java.io.IOException
java.io.IOException
public static boolean recursivelyRemoveDirectory(java.io.File d,
boolean removeDirectoryItself)
public static java.lang.String readFile(java.lang.String filename,
byte[] cb)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readFileX(java.lang.String filename)
public static java.lang.String readFile(java.lang.String filename)
throws java.io.IOException
java.io.IOException
public static java.lang.String executeCompile(java.lang.Class cls,
java.lang.String[] args)
public static java.lang.String executeMethod(java.lang.Class cls,
java.lang.String methodname,
java.lang.String[] args)
public static java.lang.String executeMethod(java.lang.reflect.Method method,
java.lang.String[] args)
public static Diff compareStringToFile(java.lang.String s,
java.lang.String rootname)
throws java.io.IOException
java.io.IOExceptionpublic static void removeFiles(java.lang.String pattern)
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||