Class TestHelper
java.lang.Object
org.nuiton.plugin.PluginHelper
org.nuiton.plugin.TestHelper
public abstract class TestHelper
extends org.nuiton.plugin.PluginHelper
- Since:
- 1.0.3
- Author:
- Tony Chemit - chemit@codelutin.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Fileprotected static Fileprotected static booleanFields inherited from class org.nuiton.plugin.PluginHelper
memoryFactors, memoryUnites, SNAPSHOT_SUFFIX, timeFactors, timeUnites -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckExistsPattern(File file, String pattern, String encoding, boolean required) Checks on the givenfilethat : file exists the givenpatternexistsrequired = true(or notrequired = false) in the content of the file.static voidcheckPattern(File file, String content, String pattern, boolean required) static Filestatic Filestatic FilegetTestDir(Class<?> type, String prefix) static booleanstatic voidsetBasedir(File basedir) static voidsetVerbose(boolean verbose) Methods inherited from class org.nuiton.plugin.PluginHelper
addResourceDir, addResourceDir, addTestResourceDir, checkEncoding, convert, convertMemory, convertTime, convertTime, copy, copyFiles, copyFiles, createDirectoryIfNecessary, createNewFile, deleteFile, expandFile, expandFiles, getEmptyKeys, getFile, getIncludedFiles, getLines, getLinesAsFiles, getLinesAsURL, getRelativePath, getUrl, prefixLines, readAsString, readAsString, removeSnapshotSuffix, renameFile, setLastModified, splitAndTrim, toGenericList, writeString
-
Field Details
-
verbose
protected static boolean verbose -
basedir
-
testBasedir
-
-
Constructor Details
-
TestHelper
public TestHelper()
-
-
Method Details
-
getTestBasedir
-
getBasedir
- Returns:
- the basedir for all tests
- See Also:
-
setBasedir
-
isVerbose
public static boolean isVerbose() -
setVerbose
public static void setVerbose(boolean verbose) -
getTestDir
-
checkExistsPattern
public static void checkExistsPattern(File file, String pattern, String encoding, boolean required) throws IOException Checks on the givenfilethat :- file exists
- the given
patternexistsrequired = true(or notrequired = false) in the content of the file.
- Parameters:
file- the file to testpattern- the pattern to searchencoding- encoding of the file to readrequired- flag to says if pattern should (or not) be found in file's content- Throws:
IOException- if could not read file
-
checkPattern
public static void checkPattern(File file, String content, String pattern, boolean required) throws IOException - Throws:
IOException
-