|
JML | ||||||||||
| 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 String |
ORACLE_SUFFIX
|
private static PrintStream |
pse
A cached value of the usual System err stream. |
private static PrintStream |
pso
A cached value of the usual System out stream. |
(package private) static String |
SAVED_SUFFIX
|
| Constructor Summary | |
Utils()
|
|
| Method Summary | |
static Diff |
compareStringToFile(String s,
String rootname)
Compares the given string to the content of the given file using a comparator that ignores platform differences in line-endings. |
static String |
executeCompile(Class cls,
String[] args)
|
static String |
executeMethod(Class cls,
String methodname,
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 String |
executeMethod(Method method,
String[] args)
Calls the given method on the given String[] argument. |
static ArrayList |
parseFoundLine(String content,
String filename)
Finds the first line with the given String in the given file and parses the content into tokens. |
static ArrayList |
parseResult(String command)
Executes the given command as an external executable, reads the text produced and tokenizes it into Strings (separated by whitespace). |
static String |
readFile(String filename)
Reads the contents of the file with the given name, returning a String. |
static String |
readFile(String filename,
byte[] cb)
Reads the contents of the file with the given name, returning a String. |
static String |
readFileX(String filename)
|
static boolean |
recursivelyRemoveDirectory(File d,
boolean removeDirectoryItself)
Deletes the contents of a directory, including subdirectories. |
static void |
removeFiles(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(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 PrintStream pso
private static final PrintStream pse
static final String ORACLE_SUFFIX
static final String SAVED_SUFFIX
| Constructor Detail |
public Utils()
| Method Detail |
public static void setStreams(PrintStream ps)
public static void restoreStreams()
public static ArrayList parseResult(String command)
throws IOException
IOException
public static ArrayList parseFoundLine(String content,
String filename)
throws IOException
IOException
public static boolean recursivelyRemoveDirectory(File d,
boolean removeDirectoryItself)
public static String readFile(String filename,
byte[] cb)
throws IOException
IOExceptionpublic static String readFileX(String filename)
public static String readFile(String filename)
throws IOException
IOException
public static String executeCompile(Class cls,
String[] args)
public static String executeMethod(Class cls,
String methodname,
String[] args)
public static String executeMethod(Method method,
String[] args)
public static Diff compareStringToFile(String s,
String rootname)
throws IOException
IOExceptionpublic static void removeFiles(String pattern)
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||