Class Assert

The Assert class provides utility methods for assertion events.

This class does not have a constructor, so you cannot create it directly.

MethodDescription
static areEqual(Object, Object)Propagates an assertion if the specified objects are not equal.
static areEqual(Object, Object, String)Propagates an assertion using the specified message if the specified objects are not equal.
static areNotEqual(Object, Object)Propagates an assertion if the specified objects are equal.
static areNotEqual(Object, Object, String)Propagates an assertion using the specified message if the specified objects are equal.
static areSame(Object, Object)Propagates an assertion if the specified objects are not the same.
static areSame(Object, Object, String)Propagates an assertion using the specified message if the specified objects are not the same.
static fail()Propagates a failure assertion.
static fail(String)Propagates a failure assertion using the specified message.
static isEmpty(Object)Propagates an assertion if the specified check does not evaluate to an empty object.
static isEmpty(Object, String)Propagates an assertion using the specified message if the specified check does not evaluate to an empty object.
static isFalse(Boolean)Propagates an assertion if the specified check does not evaluate to false.
static isFalse(Boolean, String)Propagates an assertion using the specified message if the specified check does not evaluate to false.
static isInstanceOf(Object, Object)Propagates an assertion if the specified object 'arg' is not an instance of the specified class 'clazz'.
static isInstanceOf(Object, Object, String)Propagates an assertion using the specified message if the specified object is not an instance of the specified class.
static isNotEmpty(Object)Propagates an assertion if the specified object is empty.
static isNotEmpty(Object, String)Propagates an assertion using the specified message if the specified object is empty.
static isNotNull(Object)Propagates an assertion if the specified object is null.
static isNotNull(Object, String)Propagates an assertion using the specified message if the specified object is null.
static isNull(Object)Propagates an assertion if the specified object is not null.
static isNull(Object, String)Propagates an assertion using the specified message if the specified object is not null.
static isTrue(Boolean)Propagates an assertion if the specified check does not evaluate to true.
static isTrue(Boolean, String)Propagates an assertion using the specified message if the specified check does not evaluate to true.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

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.

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.

static areNotEqual(arg1: Object, arg2: Object): void

Propagates an assertion if the specified objects are equal.

Parameters:

  • arg1 - the first object to check.
  • arg2 - the second object to check.

static areNotEqual(arg1: Object, arg2: Object, msg: String): void

Propagates an assertion using the specified message if the specified objects are equal.

Parameters:

  • arg1 - the first object to check.
  • arg2 - the second object to check.
  • msg - the assertion message.

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.

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.

static fail(): void

Propagates a failure assertion.


static fail(msg: String): void

Propagates a failure assertion using the specified message.

Parameters:

  • msg - the assertion message.

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.

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.

static isFalse(check: Boolean): void

Propagates an assertion if the specified check does not evaluate to false.

Parameters:

  • check - the condition to check.

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.

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:

But the following call will propagate an assertion:

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.

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:

But the following call will propagate an assertion:

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.

static isNotEmpty(arg: Object): void

Propagates an assertion if the specified object is empty.

Parameters:

  • arg - the object to check.

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.

static isNotNull(arg: Object): void

Propagates an assertion if the specified object is null.

Parameters:

  • arg - the object to check.

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.

static isNull(arg: Object): void

Propagates an assertion if the specified object is not null.

Parameters:

  • arg - the object to check.

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.

static isTrue(check: Boolean): void

Propagates an assertion if the specified check does not evaluate to true.

Parameters:

  • check - the condition to check.

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.