public class Assert
extends java.lang.Object
Implements utility methods to support design-by-contract. If a condition is evaluated to false, a RuntimeException will be thrown.
| Constructor and Description |
|---|
Assert() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertTrue(boolean condition,
java.lang.String msg)
Assert that the given condition is
true |
static void |
exists(java.io.File file)
Assert that the specified file is not null and exists.
|
static void |
inRange(int value,
int from,
int to)
Checks whether a value is in a specific range or not.
|
static void |
isDirectory(java.io.File file)
Assert that the specified file is not null, exists and is a directory.
|
static void |
isFile(java.io.File file)
Assert that the specified file is not null, exists and is a file.
|
static void |
nonEmpty(java.lang.String string)
Assert that the supplied string provides a value or not.
|
static void |
notNull(java.lang.Object object)
Assert that the specified object is not null.
|
public static void notNull(java.lang.Object object)
Assert that the specified object is not null.
object - the object that must be set.public static void nonEmpty(java.lang.String string)
Assert that the supplied string provides a value or not.
string - the string that must provide a value.public static void exists(java.io.File file)
Assert that the specified file is not null and exists.
file - the file that must exist.public static void isFile(java.io.File file)
Assert that the specified file is not null, exists and is a file.
file - the file that must be a file.public static void isDirectory(java.io.File file)
Assert that the specified file is not null, exists and is a directory.
file - the file that must be a directory.public static void assertTrue(boolean condition,
java.lang.String msg)
Assert that the given condition is true
condition - the conditionmsg - the messagepublic static void inRange(int value,
int from,
int to)
Checks whether a value is in a specific range or not.
value - the value that shall be tested.from - the lower bound inclusive.to - the upper bound inclusive.