|
ColdBox Platform v3.8.0 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.testing.Assertion
public class 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 actual, any expected, 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 |
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 |
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 |
---|
public any assert(boolean expression, [any message=''])
expression
- The expression to testmessage
- The message to send in the failurepublic any between(any actual, any min, any max, [any message=''])
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 failurepublic any closeTo(any actual, any expected, any delta, [any datePart=''], [any message=''])
actual
- The actual number or dateexpected
- The expected 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 failurepublic any deepKey(struct target, string key, [any message=''])
target
- The target object/structkey
- The key to check for existence anywhere in the nested structuremessage
- The message to send in the failureprivate any equalize(any expected, any actual)
expected
actual
public any fail([any message=''])
message
- The message to send in the failurepublic any getStringName(any obj)
obj
private any getTargetLength(any target)
target
public any includes(any target, any needle, [any message=''])
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 failurepublic any includesWithCase(any target, any needle, [any message=''])
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 failurepublic any instanceOf(any actual, string typeName, [any message=''])
actual
- The actual data to checktypeName
- The typename to checkmessage
- The message to send in the failurepublic any isEmpty(any target, [any message=''])
target
- The target object to check the length for, this can be a string, array, structure or querymessage
- The message to send in the failurepublic any isEqual(any expected, any actual, [any message=''])
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failurepublic any isEqualWithCase(string expected, string actual, [any message=''])
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failurepublic any isFalse(boolean actual, [any message=''])
actual
- The actual data to testmessage
- The message to send in the failurepublic any isGT(any actual, any target, [any message=''])
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failurepublic any isGTE(any actual, any target, [any message=''])
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failurepublic any isLT(any actual, any target, [any message=''])
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failurepublic any isLTE(any actual, any target, [any message=''])
actual
- The actual valuetarget
- The target valuemessage
- The message to send in the failurepublic any isNotEmpty(any target, [any message=''])
target
- The target object to check the length for, this can be a string, array, structure or querymessage
- The message to send in the failurepublic any isNotEqual(any expected, any actual, [any message=''])
expected
- The expected dataactual
- The actual data to testmessage
- The message to send in the failurepublic any isTrue(boolean actual, [any message=''])
actual
- The actual data to testmessage
- The message to send in the failurepublic any key(any target, string key, [any message=''])
target
- The target object/structkey
- The key to check for existencemessage
- The message to send in the failurepublic any lengthOf(any target, string length, [any message=''])
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 failurepublic any match(string actual, string regex, [any message=''])
actual
- The actual data to checkregex
- The regex to check withmessage
- The message to send in the failurepublic any matchWithCase(string actual, string regex, [any message=''])
actual
- The actual data to checkregex
- The regex to check withmessage
- The message to send in the failurepublic any notDeepKey(struct target, string key, [any message=''])
target
- The target object/structkey
- The key to check for existence anywhere in the nested structuremessage
- The message to send in the failurepublic any notIncludes(any target, any needle, [any message=''])
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 failurepublic any notIncludesWithCase(any target, any needle, [any message=''])
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 failurepublic any notInstanceOf(any actual, string typeName, [any message=''])
actual
- The actual data to checktypeName
- The typename to checkmessage
- The message to send in the failurepublic any notKey(any target, string key, [any message=''])
target
- The target object/structkey
- The key to check for existencemessage
- The message to send in the failurepublic any notLengthOf(any target, string length, [any message=''])
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 failurepublic any notMatch(string actual, string regex, [any message=''])
actual
- The actual data to checkregex
- The regex to check withmessage
- The message to send in the failurepublic any notNull([any actual], [any message=''])
actual
- The actual data to testmessage
- The message to send in the failurepublic any notThrows(any target, [any type=''], [any regex=''], [any message=''])
target
- The target function to execute and check for exceptionstype
- Match this type with the exception thrownregex
- Match this regex against the message of the exceptionmessage
- The message to send in the failurepublic any notTypeOf(string type, any actual, [any message=''])
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 failurepublic any null([any actual], [any message=''])
actual
- The actual data to testmessage
- The message to send in the failurepublic any throws(any target, [any type=''], [any regex='.*'], [any message=''])
target
- The target function to execute and check for exceptionstype
- Match this type with the exception thrownregex
- Match this regex against the message of the exceptionmessage
- The message to send in the failurepublic any typeOf(string type, any actual, [any message=''])
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
|
ColdBox Platform v3.8.0 | ||||
FRAMES |