MXUnit 2.1.3 (Generated: 09/27/2012)

mxunit.framework
Class Assert

WEB-INF.cftags.component
        extended by mxunit.framework.Assert
Direct Known Subclasses:
Assert , Assert , Assert , Assert

public class Assert
extends WEB-INF.cftags.component

Main component for asserting state. You will not instantiate this component directly - the framework makes it available for your TestCases. Use this to see what assertions are available and note that it can easily be extended using the Assert.addDecortor() method or by editing the mxunit-config.xml file, following the examples therein.


Constructor Summary
remote init()
          Constructor
 
Method Summary
 void addAssertDecorator([string decoratorName], [string overrideBehaviors='false'])
          Method used to dynamically add additional custom assertions at runtime
 void addAssertDecorators()
          Loads any assertions defined in mxunt-config
 any assert(string condition, [string message=''])
          Basic assertion
 any assertArrayEquals(array expected, array actual, [string message=''])
          compares two arrays, element by element, and fails if differences exist
 void assertEquals(any expected, any actual, [string message=''])
          Core assertion that compares the values the EXPECTED and ACTUAL parameters
 void assertEqualsCase(any expected, any actual, [string message=''])
          Core assertion that compares the values the EXPECTED and ACTUAL parameters
 any assertFalse(string condition, [string message=''])
 void assertNotEquals(any expected, any actual, [string message=''])
          Core assertion that compares the values the EXPECTED and ACTUAL parameters
 any assertNotSame(any expected, any actual, [string message='The two objects refer to the same instance.'])
 void assertQueryEquals(query expected, query actual, [string message=''])
 any assertSame(any expected, any actual, [string message='The two objects do not refer to the same instance.'])
 any assertStructEquals(struct expected, struct actual, [string message=''])
          compares two structures, key by key, and fails if differences exist
 boolean assertTrue(string condition, [string message=''])
          Core assertion that tests the CONDITION and throws mxunit
 any clearClassVariables()
 void fail(string message)
          Fails a test with the given MESSAGE
private void failEquals(any expected, any actual, [any message='This test failed'])
          Fails the test and prints the expected and actual values to the failure message
private void failNotEquals(any expected, any actual, [any message='This test failed'], [any caseSensitive='false'])
          Fails the test and prints the expected and actual values to the failure message
 any getActual()
 any getExpected()
 string getHashCode(any obj)
          Attempts to return hashCode representation of OBJ
 string getStringValue(any obj, [boolean caseSensitive='false'])
          Attempts to return string representation of OBJ
 any getTestStyle()
          returns the current test style
private boolean isPassByValueArray(any value)
          Checks to see if this is an array that will pass by value
private struct normalizeArguments(string AssertType, struct Args)
          Used by framework and is merely a convenience for cfunit style tests and their assertEquals and assertTrue methods
 any setTestStyle(string TestStyle)
          Sets the current test style
 void throwWrapper(string type, string message, string detail)
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

remote init()
Constructor

Method Detail

addAssertDecorator

public void addAssertDecorator([string decoratorName], [string overrideBehaviors='false'])
Method used to dynamically add additional custom assertions at runtime.

Parameters:
decoratorName - The fully qualied name of the assertion component to add; e.g., org.mycompany.MyAssertionComponent
overrideBehaviors - Tells the framework whether or not to override any existing behaviors. For example, if your org.mycompany.MyAssertionComponent component has an assertTrue() and overridBehaviors is set to TRUE, the mxunit framework will use the new assertTrue() method and not it's own.

addAssertDecorators

public void addAssertDecorators()
Loads any assertions defined in mxunt-config.xml at runtime.


assert

public any assert(string condition, [string message=''])
Basic assertion. Same effect as assertTrue()

Parameters:
condition - The condition to test. Note that expressions containing CFCs may likely fail
message - Optional custom message to display if comparison fails.

assertArrayEquals

public any assertArrayEquals(array expected, array actual, [string message=''])
compares two arrays, element by element, and fails if differences exist

Parameters:
expected
actual
message

assertEquals

public void assertEquals(any expected, any actual, [string message=''])
Core assertion that compares the values the EXPECTED and ACTUAL parameters. Throws mxunit.exception.AssertionFailedError.

Parameters:
expected - The expected object to compare.
actual - The actual object to compare.
message - Optional custom message to display if comparison fails.

assertEqualsCase

public void assertEqualsCase(any expected, any actual, [string message=''])
Core assertion that compares the values the EXPECTED and ACTUAL parameters. Throws mxunit.exception.AssertionFailedError. This is case sensitive.

Parameters:
expected - The expected object to compare.
actual - The actual object to compare.
message - Optional custom message to display if comparison fails.

assertFalse

public any assertFalse(string condition, [string message=''])

Parameters:
condition
message

assertNotEquals

public void assertNotEquals(any expected, any actual, [string message=''])
Core assertion that compares the values the EXPECTED and ACTUAL parameters. Throws mxunit.exception.AssertionFailedError.

Parameters:
expected - The expected object to compare.
actual - The actual object to compare.
message - Optional custom message to display if comparison fails.

assertNotSame

public any assertNotSame(any expected, any actual, [string message='The two objects refer to the same instance.'])

Parameters:
expected
actual
message

assertQueryEquals

public void assertQueryEquals(query expected, query actual, [string message=''])

Parameters:
expected
actual
message

assertSame

public any assertSame(any expected, any actual, [string message='The two objects do not refer to the same instance.'])

Parameters:
expected
actual
message

assertStructEquals

public any assertStructEquals(struct expected, struct actual, [string message=''])
compares two structures, key by key, and fails if differences exist

Parameters:
expected
actual
message

assertTrue

public boolean assertTrue(string condition, [string message=''])
Core assertion that tests the CONDITION and throws mxunit.exception.AssertionFailedError on failure

Parameters:
condition - The condition to test. Note that expressions containing CFCs may likely fail
message - Optional custom message to display if comparison fails.

clearClassVariables

public any clearClassVariables()


fail

public void fail(string message)
Fails a test with the given MESSAGE.

Parameters:
message - Custom message to print in the failure.

failEquals

private void failEquals(any expected, any actual, [any message='This test failed'])
Fails the test and prints the expected and actual values to the failure message

Parameters:
expected - The expected string value
actual - The actual string value
message - Custom message to print in the failure.

failNotEquals

private void failNotEquals(any expected, any actual, [any message='This test failed'], [any caseSensitive='false'])
Fails the test and prints the expected and actual values to the failure message

Parameters:
expected - The expected string value
actual - The actual string value
message - Custom message to print in the failure.
caseSensitive - Whether or not to print values in original case.

getActual

public any getActual()


getExpected

public any getExpected()


getHashCode

public string getHashCode(any obj)
Attempts to return hashCode representation of OBJ. Returns 0 for deep structs and component name or, if defined, the stringValue() representation of the component.

Parameters:
obj - Any object

getStringValue

public string getStringValue(any obj, [boolean caseSensitive='false'])
Attempts to return string representation of OBJ. Tests to see if object has toString or stringValue methods to be used for comparison and returns that string if present

Parameters:
obj - Any object
caseSensitive - If set to TRUE returns the original string unaltered. Default is to return the string in lowercase

getTestStyle

public any getTestStyle()
returns the current test style


isPassByValueArray

private boolean isPassByValueArray(any value)
Checks to see if this is an array that will pass by value

Parameters:
value - an object

normalizeArguments

private struct normalizeArguments(string AssertType, struct Args)
Used by framework and is merely a convenience for cfunit style tests and their assertEquals and assertTrue methods

Parameters:
AssertType
Args

setTestStyle

public any setTestStyle(string TestStyle)
Sets the current test style.

Parameters:
TestStyle - Use 'default' to have the framework behave like cfcunit with respect to arguments; otherwise, pass 'cfunit' to behave like cfunit (i.e. for certain assertions, the message is the first arg). This only affects assertEquals and assertTrue

throwWrapper

public void throwWrapper(string type, string message, string detail)

Parameters:
type
message
detail

MXUnit 2.1.3 (Generated: 09/27/2012)