Class Assert
dw.util
Class Assert
Object
dw.util.Assert
The Assert class provides utility methods for assertion events.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
static areEqual(arg1 : Object, arg2 : Object) : void
Propagates an assertion if the specified objects are not equal.
static areEqual(arg1 : Object, arg2 : Object, msg : String) : void
Propagates an assertion using the specified message if the specified objects are not equal.
static areSame(arg1 : Object, arg2 : Object) : void
Propagates an assertion if the specified objects are not the same.
static areSame(arg1 : Object, arg2 : Object, msg : String) : void
Propagates an assertion using the specified message if the specified objects are not the same.
static fail() : void
Propagates a failure assertion.
static fail(msg : String) : void
Propagates a failure assertion using the specified message.
static isEmpty(arg : Object) : void
Propagates an assertion if the specified check does not evaluate to an empty object.
static isEmpty(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified check does not evaluate to an empty object.
static isFalse(check : boolean) : void
Propagates an assertion if the specified check does not evaluate to false.
static isFalse(check : boolean, msg : String) : void
Propagates an assertion using the specified message if the specified check does not evaluate to false.
static isInstanceOf(clazz : Object, arg : Object) : void
Propagates an assertion if the specified object 'arg' is not an instance of the specified class 'clazz'.
static isInstanceOf(clazz : Object, arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is not an instance of the specified class.
static isNotEmpty(arg : Object) : void
Propagates an assertion if the specified object is empty.
static isNotEmpty(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is empty.
static isNotNull(arg : Object) : void
Propagates an assertion if the specified object is null.
static isNotNull(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is null.
static isNull(arg : Object) : void
Propagates an assertion if the specified object is not null.
static isNull(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is not null.
static isTrue(check : boolean) : void
Propagates an assertion if the specified check does not evaluate to true.
static isTrue(check : boolean, msg : String) : void
Propagates an assertion using the specified message if the specified check does not evaluate to true.
Method Detail
areEqual
static areEqual(arg1 : Object, arg2 : Object) : void
Propagates an assertion if the specified objects are not equal.
Parameters:
arg1 - the first object to check.
arg2 - the second object to check.

areEqual
static areEqual(arg1 : Object, arg2 : Object, msg : String) : void
Propagates an assertion using the specified message if the specified objects are not equal.
Parameters:
arg1 - the first object to check.
arg2 - the second object to check.
msg - the assertion message.

areSame
static areSame(arg1 : Object, arg2 : Object) : void
Propagates an assertion if the specified objects are not the same.
Parameters:
arg1 - the first object to check.
arg2 - the second object to check.

areSame
static areSame(arg1 : Object, arg2 : Object, msg : String) : void
Propagates an assertion using the specified message if the specified objects are not the same.
Parameters:
arg1 - the first object to check.
arg2 - the second object to check.
msg - the assertion message.

fail
static fail() : void
Propagates a failure assertion.

fail
static fail(msg : String) : void
Propagates a failure assertion using the specified message.
Parameters:
msg - the assertion message.

isEmpty
static isEmpty(arg : Object) : void
Propagates an assertion if the specified check does not evaluate to an empty object.
Parameters:
arg - the object to check.

isEmpty
static isEmpty(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified check does not evaluate to an empty object.
Parameters:
arg - the object to check.
msg - the assertion message.

isFalse
static isFalse(check : boolean) : void
Propagates an assertion if the specified check does not evaluate to false.
Parameters:
check - the condition to check.

isFalse
static isFalse(check : boolean, msg : String) : void
Propagates an assertion using the specified message if the specified check does not evaluate to false.
Parameters:
check - the condition to check.
msg - the assertion message.

isInstanceOf
static isInstanceOf(clazz : Object, arg : Object) : void
Propagates an assertion if the specified object 'arg' is not an instance of the specified class 'clazz'.
For example, the following call does not propagate an assertion:
 
     var test = new dw.util.HashMap();
     dw.util.Assert.isInstanceOf(dw.util.HashMap, test);
 
 

But the following call will propagate an assertion:
 
     var test = new dw.util.Set();
     dw.util.Assert.isInstanceOf(dw.util.HashMap, test);
 
 

Note that 'clazz' can only be a Demandware API Scripting class.

Parameters:
clazz - the scripting class to use to check the object.
arg - the object to check.

isInstanceOf
static isInstanceOf(clazz : Object, arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is not an instance of the specified class.
For example, the following call does not propagate an assertion:
 
     var test = new dw.util.HashMap();
     dw.util.Assert.isInstanceOf(dw.util.HashMap, test);
 
 

But the following call will propagate an assertion:
 
     var test = new dw.util.Set();
     dw.util.Assert.isInstanceOf(dw.util.HashMap, test);
 
 

Note that 'clazz' can only be a Demandware API Scripting class.

Parameters:
clazz - the scripting class to use to check the object.
arg - the object to check.
msg - the assertion message.

isNotEmpty
static isNotEmpty(arg : Object) : void
Propagates an assertion if the specified object is empty.
Parameters:
arg - the object to check.

isNotEmpty
static isNotEmpty(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is empty.
Parameters:
arg - the object to check.
msg - the assertion message.

isNotNull
static isNotNull(arg : Object) : void
Propagates an assertion if the specified object is null.
Parameters:
arg - the object to check.

isNotNull
static isNotNull(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is null.
Parameters:
arg - the object to check.
msg - the assertion message.

isNull
static isNull(arg : Object) : void
Propagates an assertion if the specified object is not null.
Parameters:
arg - the object to check.

isNull
static isNull(arg : Object, msg : String) : void
Propagates an assertion using the specified message if the specified object is not null.
Parameters:
arg - the object to check.
msg - the assertion message.

isTrue
static isTrue(check : boolean) : void
Propagates an assertion if the specified check does not evaluate to true.
Parameters:
check - the condition to check.

isTrue
static isTrue(check : boolean, msg : String) : void
Propagates an assertion using the specified message if the specified check does not evaluate to true.
Parameters:
check - the condition to check.
msg - the assertion message.