|
ColdBox Platform v3.8.0 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.testing.Expectation
public class Expectation
******************************************************************************* Copyright 2005-2009 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.coldbox.org | www.luismajano.com | 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 & Description | Default | Serializable | Required |
any
|
assert
Attributes: |
|
true
|
false
|
any
|
mockbox
Attributes: |
|
true
|
false
|
any
|
spec
Attributes: |
|
true
|
false
|
Constructor Summary | |
---|---|
init(any spec, any assertions, any mockBox)
Constructor |
Method Summary | |
---|---|
any |
GETASSERT()
|
any |
GETMOCKBOX()
|
any |
GETSPEC()
|
Expectation |
SETASSERT(any assert)
|
Expectation |
SETMOCKBOX(any mockbox)
|
Expectation |
SETSPEC(any spec)
|
any |
_not()
Set the not bit to TRUE for this expectation |
any |
fail([any message=''])
Fail an assertion |
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 |
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 WEB-INF.cftags.component |
---|
None
|
Constructor Detail |
---|
public init(any spec, any assertions, any mockBox)
spec
- The spec that this matcher belongs to.assertions
- The TestBox assertions object: coldbox.system.testing.AssertionmockBox
- A reference to MockBoxProperty Detail |
---|
any assert
default
- serializable
- truerequired
- falseany mockbox
default
- serializable
- truerequired
- falseany spec
default
- serializable
- truerequired
- falseMethod Detail |
---|
public any GETASSERT()
public any GETMOCKBOX()
public any GETSPEC()
public Expectation SETASSERT(any assert)
assert
public Expectation SETMOCKBOX(any mockbox)
mockbox
public Expectation SETSPEC(any spec)
spec
public any _not()
public any fail([any message=''])
message
- The message to fail with.public any onMissingMethod(any missingMethodName, any missingMethodArguments)
missingMethodName
missingMethodArguments
public any registerMatcher(any name, any body)
name
- The name of the custom matcherbody
- The body closure/udf representing this matcher.public any toBe(any expected, [any message=''])
expected
- The expected datamessage
- The message to send in the failurepublic any toBeBetween(any min, any max, [any message=''])
min
- The expected min number or datemax
- The expected max number or datemessage
- The message to send in the failurepublic any toBeCloseTo(any expected, any delta, [any datePart=''], [any message=''])
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 failurepublic any toBeEmpty([any message=''])
message
- The message to send in the failurepublic any toBeFalse([any message=''])
message
- The message to send in the failurepublic any toBeGT(any target, [any message=''])
target
- The target valuemessage
- The message to send in the failurepublic any toBeGTE(any target, [any message=''])
target
- The target valuemessage
- The message to send in the failurepublic any toBeInstanceOf(string typeName, [any message=''])
typeName
- The typename to checkmessage
- The message to send in the failurepublic any toBeLT(any target, [any message=''])
target
- The target valuemessage
- The message to send in the failurepublic any toBeLTE(any target, [any message=''])
target
- The target valuemessage
- The message to send in the failurepublic any toBeNull([any message=''])
message
- The message to send in the failurepublic any toBeTrue([any message=''])
message
- The message to send in the failurepublic any toBeTypeOf(string type, [any message=''])
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 failurepublic any toBeWithCase(string expected, [any message=''])
expected
- The expected datamessage
- The message to send in the failurepublic any toHaveDeepKey(string key, [any message=''])
key
- The key to check for existence anywhere in the nested structuremessage
- The message to send in the failurepublic any toHaveKey(string key, [any message=''])
key
- The key to check for existencemessage
- The message to send in the failurepublic any toHaveLength(string length, [any message=''])
length
- The length to checkmessage
- The message to send in the failurepublic any toInclude(any needle, [any message=''])
needle
- The substring to find in a string or the value to find in an arraymessage
- The message to send in the failurepublic any toIncludeWithCase(any target, any needle, [any message=''])
target
needle
- The substring to find in a string or the value to find in an arraymessage
- The message to send in the failurepublic any toMatch(string regex, [any message=''])
regex
- The regex to check withmessage
- The message to send in the failurepublic any toMatchWithCase(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 toThrow([any type=''], [any regex='.*'], [any message=''])
type
- Match this type with the exception thrownregex
- Match this regex against the message of the exceptionmessage
- The message to send in the failure
|
ColdBox Platform v3.8.0 | ||||
FRAMES |