public class ScriptAssert extends Object
We specifically do not use the TestNG class here so that we avoid a runtime dependency on TestNG.
| Constructor and Description |
|---|
ScriptAssert() |
ScriptAssert(ScriptEngine scriptEngine) |
| Modifier and Type | Method and Description |
|---|---|
void |
assertEquals(Collection<?> actual,
Collection<?> expected) |
void |
assertEquals(Collection<?> actual,
Collection<?> expected,
String msg) |
void |
assertEquals(Object actual,
Object expected) |
void |
assertEquals(Object actual,
Object expected,
String msg) |
void |
assertEqualsNoOrder(Object[] actual,
Object[] expected) |
void |
assertEqualsNoOrder(Object[] actual,
Object[] expected,
String msg) |
void |
assertExists(String identifier) |
void |
assertFalse(boolean condition) |
void |
assertFalse(boolean condition,
String msg) |
void |
assertNotNull(Object object) |
void |
assertNotNull(Object object,
String msg) |
void |
assertNotSame(Object actual,
Object expected) |
void |
assertNotSame(Object actual,
Object expected,
String msg) |
void |
assertNull(Object object) |
void |
assertNull(Object object,
String msg) |
void |
assertNumberEqualsJS(double actual,
double expected,
String msg)
Deprecated.
- it is now possible to use assertEquals() with numbers from within javascript because we
now only provide
assertEquals(Object, Object) to which the numbers convert to correctly. |
void |
assertSame(Object actual,
Object expected) |
void |
assertSame(Object actual,
Object expected,
String msg) |
void |
assertTrue(boolean condition) |
void |
assertTrue(boolean condition,
String msg) |
void |
fail() |
void |
fail(String msg) |
void |
fail(String msg,
Throwable throwable) |
void |
init(ScriptEngine engine) |
public ScriptAssert()
public ScriptAssert(ScriptEngine scriptEngine)
public void init(ScriptEngine engine)
public void assertTrue(boolean condition,
String msg)
public void assertTrue(boolean condition)
public void assertFalse(boolean condition,
String msg)
public void assertFalse(boolean condition)
public void fail(String msg)
public void fail()
public void assertNotNull(Object object)
public void assertNull(Object object)
public void assertEquals(Collection<?> actual, Collection<?> expected)
public void assertEquals(Collection<?> actual, Collection<?> expected, String msg)
public void assertExists(String identifier)
@Deprecated public void assertNumberEqualsJS(double actual, double expected, String msg)
assertEquals(Object, Object) to which the numbers convert to correctly.x = 1 and y = 1.0 are considered to
be of the same type. From within a (JavaScript) script if you were to call assertEquals(x, y), you
would get an exception that looks something like,
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: The choice of Java constructor assertEquals matching JavaScript argument types (number,number,string) is ambiguous; candidate constructors are: void assertEquals(java.lang.String,java.lang.String,java.lang.String) void assertEquals(double,double,double) void assertEquals(float,float,float) void assertEquals(long,long,java.lang.String) void assertEquals(byte,byte,java.lang.String) void assertEquals(char,char,java.lang.String) void assertEquals(short,short,java.lang.String) void assertEquals(int,int,java.lang.String) (To avoid the ambiguity when comparing numbers in JavaScript scripts, it is recommended to use this method.#1) in at line number 1
actual - The actual valueexpected - The expected valuemsg - A useful, meaningful error messageCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.