|
MXUnit 2.1.3 (Generated: 09/27/2012) | ||||
FRAMES |
WEB-INF.cftags.componentmxunit.framework.Assert
public class Assert
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 |
---|
remote init()
Method Detail |
---|
public void addAssertDecorator([string decoratorName], [string overrideBehaviors='false'])
decoratorName
- The fully qualied name of the assertion component to add; e.g., org.mycompany.MyAssertionComponentoverrideBehaviors
- 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.public void addAssertDecorators()
public any assert(string condition, [string message=''])
condition
- The condition to test. Note that expressions containing CFCs may likely failmessage
- Optional custom message to display if comparison fails.public any assertArrayEquals(array expected, array actual, [string message=''])
expected
actual
message
public void assertEquals(any expected, any actual, [string message=''])
expected
- The expected object to compare.actual
- The actual object to compare.message
- Optional custom message to display if comparison fails.public void assertEqualsCase(any expected, any actual, [string message=''])
expected
- The expected object to compare.actual
- The actual object to compare.message
- Optional custom message to display if comparison fails.public any assertFalse(string condition, [string message=''])
condition
message
public void assertNotEquals(any expected, any actual, [string message=''])
expected
- The expected object to compare.actual
- The actual object to compare.message
- Optional custom message to display if comparison fails.public any assertNotSame(any expected, any actual, [string message='The two objects refer to the same instance.'])
expected
actual
message
public void assertQueryEquals(query expected, query actual, [string message=''])
expected
actual
message
public any assertSame(any expected, any actual, [string message='The two objects do not refer to the same instance.'])
expected
actual
message
public any assertStructEquals(struct expected, struct actual, [string message=''])
expected
actual
message
public boolean assertTrue(string condition, [string message=''])
condition
- The condition to test. Note that expressions containing CFCs may likely failmessage
- Optional custom message to display if comparison fails.public any clearClassVariables()
public void fail(string message)
message
- Custom message to print in the failure.private void failEquals(any expected, any actual, [any message='This test failed'])
expected
- The expected string valueactual
- The actual string valuemessage
- Custom message to print in the failure.private void failNotEquals(any expected, any actual, [any message='This test failed'], [any caseSensitive='false'])
expected
- The expected string valueactual
- The actual string valuemessage
- Custom message to print in the failure.caseSensitive
- Whether or not to print values in original case.public any getActual()
public any getExpected()
public string getHashCode(any obj)
obj
- Any objectpublic string getStringValue(any obj, [boolean caseSensitive='false'])
obj
- Any objectcaseSensitive
- If set to TRUE returns the original string unaltered. Default is to return the string in lowercasepublic any getTestStyle()
private boolean isPassByValueArray(any value)
value
- an objectprivate struct normalizeArguments(string AssertType, struct Args)
AssertType
Args
public any setTestStyle(string TestStyle)
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 assertTruepublic void throwWrapper(string type, string message, string detail)
type
message
detail
|
MXUnit 2.1.3 (Generated: 09/27/2012) | ||||
FRAMES |