WEB-INF.cftags.component testbox.system.Assertion
******************************************************************************* Copyright 2005-2009 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.coldbox.org | www.luismajano.com | www.ortussolutions.com ******************************************************************************* This object represents our Assertion style DSL for Unit style testing
Method Summary | |
---|---|
any
|
assert(boolean expression, [any message=''])
Assert that the passed expression is true. |
any
|
between(any actual, any min, any max, [any message=''])
Assert that the passed in actual number or date is between the passed in min and max values. |
any
|
closeTo(any expected, any actual, any delta, [any datePart=''], [any message=''])
Assert that the passed in actual number or date is expected to be close to it within +/- a passed delta and optional datepart. |
any
|
deepKey(struct target, string key, [any message=''])
Assert that a given key exists in the passed in struct by searching the entire nested structure. |
private any
|
equalize(any expected, any actual)
******************************** PRIVATE Methods **********************************. |
any
|
fail([any message=''])
Fail assertion. |
private any
|
getIdentityHashCode(any target)
|
any
|
getStringName(any obj)
Get a string name representation of an incoming object. |
private any
|
getTargetLength(any target)
|
any
|
includes(any target, any needle, [any message=''])
Assert that the given "needle" argument exists in the incoming string or array with no case-sensitivity. |
any
|
includesWithCase(any target, any needle, [any message=''])
Assert that the given "needle" argument exists in the incoming string or array with case-sensitivity. |
any
|
instanceOf(any actual, string typeName, [any message=''])
Assert that the actual object is of the expected instance type. |
any
|
isEmpty(any target, [any message=''])
Assert that a a given string, array, structure or query is empty. |
any
|
isEqual(any expected, any actual, [any message=''])
Assert something is equal to each other, no case is required. |
any
|
isEqualWithCase(string expected, string actual, [any message=''])
Assert strings are equal to each other with case. |
any
|
isFalse(boolean actual, [any message=''])
Assert something is false. |
any
|
isGT(any actual, any target, [any message=''])
Assert that the actual value is greater than the target value. |
any
|
isGTE(any actual, any target, [any message=''])
Assert that the actual value is greater than or equal the target value. |
any
|
isLT(any actual, any target, [any message=''])
Assert that the actual value is less than the target value. |
any
|
isLTE(any actual, any target, [any message=''])
Assert that the actual value is less than or equal the target value. |
any
|
isNotEmpty(any target, [any message=''])
Assert that a a given string, array, structure or query is not empty. |
any
|
isNotEqual(any expected, any actual, [any message=''])
Assert something is not equal to each other, no case is required. |
any
|
isNotSameInstance(any expected, any actual, [any message=''])
Assert an object is not the same instance as another object. |
any
|
isSameInstance(any expected, any actual, [any message=''])
Assert an object is the same instance as another object. |
any
|
isTrue(boolean actual, [any message=''])
Assert something is true. |
any
|
key(any target, string key, [any message=''])
Assert that a given key exists in the passed in struct/object. |
any
|
lengthOf(any target, string length, [any message=''])
Assert the size of a given string, array, structure or query. |
any
|
match(string actual, string regex, [any message=''])
Assert that the actual data matches the incoming regular expression with no case sensitivity. |
any
|
matchWithCase(string actual, string regex, [any message=''])
Assert that the actual data matches the incoming regular expression with case sensitivity. |
any
|
notDeepKey(struct target, string key, [any message=''])
Assert that a given key DOES NOT exists in the passed in struct by searching the entire nested structure. |
any
|
notIncludes(any target, any needle, [any message=''])
Assert that the given "needle" argument exists in the incoming string or array with no case-sensitivity. |
any
|
notIncludesWithCase(any target, any needle, [any message=''])
Assert that the given "needle" argument does not exist in the incoming string or array with case-sensitivity. |
any
|
notInstanceOf(any actual, string typeName, [any message=''])
Assert that the actual object is NOT of the expected instance type. |
any
|
notKey(any target, string key, [any message=''])
Assert that a given key DOES NOT exist in the passed in struct/object. |
any
|
notLengthOf(any target, string length, [any message=''])
Assert the size of a given string, array, structure or query. |
any
|
notMatch(string actual, string regex, [any message=''])
Assert that the actual data does NOT match the incoming regular expression with no case sensitivity. |
any
|
notNull([any actual], [any message=''])
Assert something is not null. |
any
|
notThrows(any target, [any type=''], [any regex=''], [any message=''])
Assert that the passed in function will NOT throw an exception, an exception of a specified type or exception message regex. |
any
|
notTypeOf(string type, any actual, [any message=''])
Assert that is NOT a type of the incoming actual data, it uses the internal ColdFusion isValid() function behind the scenes. |
any
|
null([any actual], [any message=''])
Assert something is null. |
any
|
throws(any target, [any type=''], [any regex='.*'], [any message=''])
Assert that the passed in function will throw an exception. |
any
|
typeOf(string type, any actual, [any message=''])
Assert the type of the incoming actual data, it uses the internal ColdFusion isValid() function behind the scenes. |
Methods inherited from class WEB-INF.cftags.component |
---|
None |
Method Detail |
---|
Assert that the passed expression is true
expression
- The expression to testmessage
- The message to send in the failureAssert that the passed in actual number or date is between the passed in min and max values
actual
- The actual number or date to evaluatemin
- The expected min number or datemax
- The expected max number or datemessage
- The message to send in the failureAssert that the passed in actual number or date is expected to be close to it within +/- a passed delta and optional datepart
expected
- The expected number or dateactual
- The actual number or datedelta
- The +/- delta to range itdatePart
- If passed in values are dates, then you can use the datepart to evaluate itmessage
- The message to send in the failureAssert that a given key exists in the passed in struct by searching the entire nested structure
target
- The target object/structkey
- The key to check for existence anywhere in the nested structuremessage
- The message to send in the failure******************************** PRIVATE Methods **********************************
expected
actual
Fail assertion
message
- The message to send in the failuretarget
Get a string name representation of an incoming object.
obj
target
Assert that the given "needle" argument exists in the incoming string or array with no case-sensitivity
target
- The target object to check if the incoming needle exists in. This can be a string or arrayneedle
- The substring to find in a string or the value to find in an arraymessage
- The message to send in the failureAssert that the given "needle" argument exists in the incoming string or array with case-sensitivity
target
- The target object to check if the incoming needle exists in. This can be a string or arrayneedle
- The substring to find in a string or the value to find in an arraymessage
- The message to send in the failureAssert that the actual object is of the expected instance type
actual
- The actual data to checktypeName
- The typename to checkmessage
- The message to send in the failureAssert that a a given string, array, structure or query is empty
target
- The target object to check the length for, this can be a string, array, structure or querymessage
- The message to send in the failureAssert something is equal to each other, no case is required
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failureAssert strings are equal to each other with case.
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failureAssert something is false
actual
- The actual data to testmessage
- The message to send in the failureAssert that the actual value is greater than the target value
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failureAssert that the actual value is greater than or equal the target value
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failureAssert that the actual value is less than the target value
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failureAssert that the actual value is less than or equal the target value
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failureAssert that a a given string, array, structure or query is not empty
target
- The target object to check the length for, this can be a string, array, structure or querymessage
- The message to send in the failureAssert something is not equal to each other, no case is required
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failureAssert an object is not the same instance as another object
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failureAssert an object is the same instance as another object
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failureAssert something is true
actual
- The actual data to testmessage
- The message to send in the failureAssert that a given key exists in the passed in struct/object
target
- The target object/structkey
- The key to check for existencemessage
- The message to send in the failureAssert the size of a given string, array, structure or query
target
- The target object to check the length for, this can be a string, array, structure or querylength
- The length to checkmessage
- The message to send in the failureAssert that the actual data matches the incoming regular expression with no case sensitivity
actual
- The actual data to checkregex
- The regex to check withmessage
- The message to send in the failureAssert that the actual data matches the incoming regular expression with case sensitivity
actual
- The actual data to checkregex
- The regex to check withmessage
- The message to send in the failureAssert that a given key DOES NOT exists in the passed in struct by searching the entire nested structure
target
- The target object/structkey
- The key to check for existence anywhere in the nested structuremessage
- The message to send in the failureAssert that the given "needle" argument exists in the incoming string or array with no case-sensitivity
target
- The target object to check if the incoming needle exists in. This can be a string or arrayneedle
- The substring to find in a string or the value to find in an arraymessage
- The message to send in the failureAssert that the given "needle" argument does not exist in the incoming string or array with case-sensitivity
target
- The target object to check if the incoming needle exists in. This can be a string or arrayneedle
- The substring to find in a string or the value to find in an arraymessage
- The message to send in the failureAssert that the actual object is NOT of the expected instance type
actual
- The actual data to checktypeName
- The typename to checkmessage
- The message to send in the failureAssert that a given key DOES NOT exist in the passed in struct/object
target
- The target object/structkey
- The key to check for existencemessage
- The message to send in the failureAssert the size of a given string, array, structure or query
target
- The target object to check the length for, this can be a string, array, structure or querylength
- The length to checkmessage
- The message to send in the failureAssert that the actual data does NOT match the incoming regular expression with no case sensitivity
actual
- The actual data to checkregex
- The regex to check withmessage
- The message to send in the failureAssert something is not null
actual
- The actual data to testmessage
- The message to send in the failureAssert that the passed in function will NOT throw an exception, an exception of a specified type or exception message regex
target
- The target function to execute and check for exceptionstype
- Match this type with the exception thrownregex
- Match this regex against the message+detail of the exceptionmessage
- The message to send in the failureAssert that is NOT a type of the incoming actual data, it uses the internal ColdFusion isValid() function behind the scenes
type
- The type to check, valid types are: array, binary, boolean, component, date, time, float, numeric, integer, query, string, struct, url, uuidactual
- The actual data to checkmessage
- The message to send in the failureAssert something is null
actual
- The actual data to testmessage
- The message to send in the failureAssert that the passed in function will throw an exception
target
- The target function to execute and check for exceptionstype
- Match this type with the exception thrownregex
- Match this regex against the message + detail of the exceptionmessage
- The message to send in the failureAssert the type of the incoming actual data, it uses the internal ColdFusion isValid() function behind the scenes
type
- The type to check, valid types are: array, binary, boolean, component, date, time, float, numeric, integer, query, string, struct, url, uuidactual
- The actual data to checkmessage
- The message to send in the failure