public class FileAsserts extends Object
Constructor and Description |
---|
FileAsserts() |
Modifier and Type | Method and Description |
---|---|
static void |
assertFileContains(String msg,
String str,
File file)
Assert that a given string exists in the file.
|
static void |
assertFileContainsExactly(String msg,
String toMatch,
File file)
Assert that a given file contains exactly the string given.
|
static void |
assertFileMatches(String msg,
String regexp,
File file)
Assert that a given pattern has a match in the file.
|
static void |
assertFileNotContains(String msg,
File file,
String str)
Assert that a given string exists in the file.
|
static void |
assertFileNumberOfLines(String msg,
File file,
int n)
Assert that a given file has the expected number of lines If it doesn't, fail and print the file contents.
|
public FileAsserts()
public static void assertFileContains(String msg, String str, File file)
msg
- An explanatory message.str
- A string to find in the file.file
- A file to scan.public static void assertFileMatches(String msg, String regexp, File file)
msg
- An explanatory message.regexp
- A pattern to search for in the file.file
- A file to scan.public static void assertFileNotContains(String msg, File file, String str)
msg
- An explanatory message.file
- A file to scan.str
- A string to find in the file.public static void assertFileNumberOfLines(String msg, File file, int n)
msg
- an explanatory messagefile
- the File to checkn
- the expected number of linespublic static void assertFileContainsExactly(String msg, String toMatch, File file)
msg
- An explanatory messagetoMatch
- The string that should be the full contents of the filefile
- The file that the string should be in.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.