railo-context.Component testbox.system.Expectation
Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com The Expectation CFC holds a current expectation with all the required matcher methods to provide you with awesome BDD expressions and testing.
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
assert
|
true
|
false
|
|
any
|
mockbox
|
true
|
false
|
|
any
|
spec
|
true
|
false
|
Constructor Summary | |
---|---|
init(any spec, any assertions, any mockBox)
Constructor. |
Method Summary | |
---|---|
any
|
_not()
Set the not bit to TRUE for this expectation. |
any
|
fail([any message=''])
Fail an assertion. |
string
|
getAssert()
|
string
|
getMockbox()
|
string
|
getSpec()
|
any
|
onMissingMethod(any missingMethodName, any missingMethodArguments)
Process dynamic expectations like any matcher starting with the word "not" is negated. |
any
|
registerMatcher(any name, any body)
Registers a custom matcher on this Expectation object. |
any
|
setAssert(any assert)
|
any
|
setMockbox(any mockbox)
|
any
|
setSpec(any spec)
|
any
|
toBe(any expected, [any message=''])
Assert something is equal to each other, no case is required. |
any
|
toBeBetween(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
|
toBeCloseTo(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
|
toBeEmpty([any message=''])
Assert that a a given string, array, structure or query is empty. |
any
|
toBeFalse([any message=''])
Assert something is false. |
any
|
toBeGT(any target, [any message=''])
Assert that the actual value is greater than the target value. |
any
|
toBeGTE(any target, [any message=''])
Assert that the actual value is greater than or equal the target value. |
any
|
toBeInstanceOf(string typeName, [any message=''])
Assert that the actual object is of the expected instance type. |
any
|
toBeLT(any target, [any message=''])
Assert that the actual value is less than the target value. |
any
|
toBeLTE(any target, [any message=''])
Assert that the actual value is less than or equal the target value. |
any
|
toBeNull([any message=''])
Assert something is null. |
any
|
toBeTrue([any message=''])
Assert something is true. |
any
|
toBeTypeOf(string type, [any message=''])
Assert the type of the incoming actual data, it uses the internal ColdFusion isValid() function behind the scenes. |
any
|
toBeWithCase(string expected, [any message=''])
Assert strings are equal to each other with case. |
any
|
toHaveDeepKey(string key, [any message=''])
Assert that a given key exists in the passed in struct by searching the entire nested structure. |
any
|
toHaveKey(string key, [any message=''])
Assert that a given key exists in the passed in struct/object. |
any
|
toHaveLength(string length, [any message=''])
Assert the size of a given string, array, structure or query. |
any
|
toInclude(any needle, [any message=''])
Assert that the given "needle" argument exists in the incoming string or array with no case-sensitivity. |
any
|
toIncludeWithCase(any target, any needle, [any message=''])
Assert that the given "needle" argument exists in the incoming string or array with case-sensitivity. |
any
|
toMatch(string regex, [any message=''])
Assert that the actual data matches the incoming regular expression with no case sensitivity. |
any
|
toMatchWithCase(string actual, string regex, [any message=''])
Assert that the actual data matches the incoming regular expression with case sensitivity. |
any
|
toThrow([any type=''], [any regex='.*'], [any message=''])
Assert that the passed in function will throw an exception. |
Methods inherited from class railo-context.Component |
---|
None |
Constructor Detail |
---|
Constructor
spec
- The spec that this matcher belongs to.assertions
- The TestBox assertions object: testbox.system.AssertionmockBox
- A reference to MockBoxProperty Detail |
---|
required
- falseserializable
- truerequired
- falseserializable
- truerequired
- falseserializable
- trueMethod Detail |
---|
Set the not bit to TRUE for this expectation.
Fail an assertion
message
- The message to fail with.Process dynamic expectations like any matcher starting with the word "not" is negated
missingMethodName
missingMethodArguments
Registers a custom matcher on this Expectation object
name
- The name of the custom matcherbody
- The body closure/udf representing this matcher.assert
mockbox
spec
Assert something is equal to each other, no case is required
expected
- The expected datamessage
- The message to send in the failureAssert that the passed in actual number or date is between the passed in min and max values
min
- 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 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 a given string, array, structure or query is empty
message
- The message to send in the failureAssert something is false
message
- The message to send in the failureAssert that the actual value is greater than the target value
target
- The target valuemessage
- The message to send in the failureAssert that the actual value is greater than or equal the target value
target
- The target valuemessage
- The message to send in the failureAssert that the actual object is of the expected instance type
typeName
- The typename to checkmessage
- The message to send in the failureAssert that the actual value is less than the target value
target
- The target valuemessage
- The message to send in the failureAssert that the actual value is less than or equal the target value
target
- The target valuemessage
- The message to send in the failureAssert something is null
message
- The message to send in the failureAssert something is true
message
- 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, uuidmessage
- The message to send in the failureAssert strings are equal to each other with case.
expected
- The expected datamessage
- The message to send in the failureAssert that a given key exists in the passed in struct by searching the entire nested structure
key
- The key to check for existence anywhere in the nested structuremessage
- The message to send in the failureAssert that a given key exists in the passed in struct/object
key
- The key to check for existencemessage
- The message to send in the failureAssert the size of a given string, array, structure or query
length
- The length to checkmessage
- The message to send in the failureAssert that the given "needle" argument exists in the incoming string or array with no case-sensitivity
needle
- 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
needle
- 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 data matches the incoming regular expression with no case sensitivity
regex
- 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 the passed in function will throw an exception
type
- Match this type with the exception thrownregex
- Match this regex against the message of the exceptionmessage
- The message to send in the failure