ColdBox Platform Version 2.6.4

coldbox.system.testing
Class BaseTestCase

WEB-INF.cftags.component
        extended by mxunit.framework.Assert
            extended by mxunit.framework.TestCase
                extended by coldbox.system.testing.BaseTestCase
Direct Known Subclasses:
BaseHandlerTest , BaseInterceptorTest , BaseModelTest , BasePluginTest

public class BaseTestCase
extends mxunit.framework.TestCase

A base test case for doing ColdBox Testing based on the MXUnit Framework


Method Summary
private void $abort()
          Facade for cfabort
private void $dump(any var, [boolean isAbort='false'])
          Facade for cfmx dump
private void $include([string template])
          Facade for cfinclude
private void $rethrow(any throwObject)
          Rethrow facade
private any $throw(string message, [string detail=''], [string type='Framework'])
          Facade for cfthrow
private void announceInterception(string state, [struct interceptData='[runtime expression]'])
          Announce an interception in the system
private any execute(string event, [boolean private='false'], [boolean prepostExempt='false'])
          Executes a framework lifecycle by executing an event
private string getAppMapping()
          Get the AppMapping used for this test case
private string getColdboxAppKey()
          Get the coldboxAppKey used to store the coldbox controller in application scope
private any getColdboxOCM()
          Get a reference to the cache manager
private string getConfigMapping()
          Get the ConfigMapping for this test case
private any getController()
          Get a reference to the ColdBox mock controller
private AbstractFlashScope getFlashScope()
          Returns to you the currently used flash ram object
private any getInterceptor([string interceptorName], [boolean deepSearch='false'])
          Get an interceptor
private MockBox getMockBox()
          Get a reference to the MockBox framework
private any getMockModel(string name, [boolean clearMethods='false'])
          *ColdBox must be loaded for this to work
private RequestContext getMockRequestContext([boolean clearMethods='false'])
          Builds an empty functioning request context mocked with methods via MockBox
private any getModel(string name, [boolean useSetterInjection='false'], [string onDICompleteUDF='onDIComplete'], [boolean debugMode='false'])
          Create or retrieve model objects by convention
private any getRequestContext()
          Get a reference to the current mock request context
private Util getUtil()
          Create and return a util object
private void metadataInspection()
          Inspect test case for annotations
private query querySim(string queryData)
          Query Simulator
private void reset()
          Reset the persistence of the unit test coldbox app, basically removes the controller from application scope
private void setAppMapping(string AppMapping)
          Set the AppMapping for this test case
private void setColdboxAppKey(string coldboxAppKey)
          Override the coldboxAppKey, used to store the coldbox controller in application scope
private void setConfigMapping(string ConfigMapping)
          Set the ConfigMapping for this test case
 any setup()
          The main setup method for running ColdBox enabled tests
private void setupRequest(string event)
          Setup an initial request capture
 any tearDown()
          The main teardown for ColdBox enabled applications
 
Methods inherited from class mxunit.framework.TestCase
TestCase, addTrace, clearDebug, createRequestScopeDebug, createResult, debug, dump, getDebug, getDebugWrapper, getRunnableMethods, getTrace, initDebug, initProperties, injectMethod, injectProperty, makePublic, print, println, run, runBare, runTest, runTestRemote, setDebugWrapper, stopRequestScopeDebug, testIsAcceptable, toStringValue
 
Methods inherited from class mxunit.framework.Assert
addAssertDecorator, addAssertDecorators, assert, assertEquals, assertFalse, assertNotEquals, assertNotSame, assertSame, assertTrue, clearClassVariables, fail, failEquals, failNotEquals, getHashCode, getStringValue, getTestStyle, init, normalizeArguments, setTestStyle, throwWrapper
 
Methods inherited from class WEB-INF.cftags.component
 

Method Detail

$abort

private void $abort()
Facade for cfabort


$dump

private void $dump(any var, [boolean isAbort='false'])
Facade for cfmx dump

Parameters:
var
isAbort - Abort also

$include

private void $include([string template])
Facade for cfinclude

Parameters:
template

$rethrow

private void $rethrow(any throwObject)
Rethrow facade

Parameters:
throwObject - The cfcatch object

$throw

private any $throw(string message, [string detail=''], [string type='Framework'])
Facade for cfthrow

Parameters:
message
detail
type

announceInterception

private void announceInterception(string state, [struct interceptData='[runtime expression]'])
Announce an interception in the system.

Parameters:
state - The interception state to execute
interceptData - A data structure used to pass intercepted information.

execute

private any execute(string event, [boolean private='false'], [boolean prepostExempt='false'])
Executes a framework lifecycle by executing an event. This method returns a request context object that can be used for assertions

Parameters:
event - The event to execute
private - Call a private event or not
prepostExempt - If true, pre/post handlers will not be fired.

getAppMapping

private string getAppMapping()
Get the AppMapping used for this test case


getColdboxAppKey

private string getColdboxAppKey()
Get the coldboxAppKey used to store the coldbox controller in application scope.


getColdboxOCM

private any getColdboxOCM()
Get a reference to the cache manager


getConfigMapping

private string getConfigMapping()
Get the ConfigMapping for this test case


getController

private any getController()
Get a reference to the ColdBox mock controller


getFlashScope

private AbstractFlashScope getFlashScope()
Returns to you the currently used flash ram object


getInterceptor

private any getInterceptor([string interceptorName], [boolean deepSearch='false'])
Get an interceptor

Parameters:
interceptorName - The name of the interceptor to search for
deepSearch - By default we search the cache for the interceptor reference. If true, we search all the registered interceptor states for a match.

getMockBox

private MockBox getMockBox()
Get a reference to the MockBox framework


getMockModel

private any getMockModel(string name, [boolean clearMethods='false'])
*ColdBox must be loaded for this to work. Get a mock model object by convention. You can optional clear all the methods on the model object if you wanted to. The object is created but not initiated, that would be your job.

Parameters:
name - The name of the model to mock
clearMethods - If true, all methods in the target mock object will be removed. You can then mock only the methods that you want to mock

getMockRequestContext

private RequestContext getMockRequestContext([boolean clearMethods='false'])
Builds an empty functioning request context mocked with methods via MockBox. You can also optionally wipe all methods on it.

Parameters:
clearMethods - Clear Methods on it?

getModel

private any getModel(string name, [boolean useSetterInjection='false'], [string onDICompleteUDF='onDIComplete'], [boolean debugMode='false'])
Create or retrieve model objects by convention

Parameters:
name - The name of the model to retrieve
useSetterInjection - Whether to use setter injection alongside the annotations property injection. cfproperty injection takes precedence.
onDICompleteUDF - After Dependencies are injected, this method will look for this UDF and call it if it exists. The default value is onDIComplete
debugMode - Debugging Mode or not

getRequestContext

private any getRequestContext()
Get a reference to the current mock request context


getUtil

private Util getUtil()
Create and return a util object


metadataInspection

private void metadataInspection()
Inspect test case for annotations


querySim

private query querySim(string queryData)
Query Simulator

Parameters:
queryData - The data to create queries

reset

private void reset()
Reset the persistence of the unit test coldbox app, basically removes the controller from application scope


setAppMapping

private void setAppMapping(string AppMapping)
Set the AppMapping for this test case

Parameters:
AppMapping

setColdboxAppKey

private void setColdboxAppKey(string coldboxAppKey)
Override the coldboxAppKey, used to store the coldbox controller in application scope.

Parameters:
coldboxAppKey

setConfigMapping

private void setConfigMapping(string ConfigMapping)
Set the ConfigMapping for this test case

Parameters:
ConfigMapping

setup

public any setup()
The main setup method for running ColdBox enabled tests


setupRequest

private void setupRequest(string event)
Setup an initial request capture. I basically look at the FORM/URL scopes and create the request collection out of them.

Parameters:
event - The event to setup the request context with

tearDown

public any tearDown()
The main teardown for ColdBox enabled applications

Overrides:
tearDown in class mxunit.framework.TestCase

ColdBox Platform Version 2.6.4