Managed Hosting



Project Home Blog Forums Wiki Known Issues Contact Project

ColdMock Issue: mock.invalidType

Name: mock.invalidType
ID: 3
Project: ColdMock
Type: Bug
Area: Code
Severity: High
Status: Open
Related URL:
Creator: Henry Ho
Created: 11/27/09 5:02 PM
Updated: 11/27/09 5:04 PM
Description: I'm not sure why I'm getting mock.invalidType exception.

Argument t of method make in component com.util.factory is not of type Test.

The error occurred in D:\Project\coldmock\MockFactory.cfc: line 221
Called from D:\Project\billing\com\util\test.cfc: line 6
Called from D:\Project\billing\com\test.cfm: line 10

219 :                      <cfif IsObject(arguments.missingMethodArguments[local.tempKey]) and local.currentFunction.parameters[local.thisArg].type neq "any"
220 :                         and not IsInstanceOf(arguments.missingMethodArguments[local.tempKey], local.currentFunction.parameters[local.thisArg].type)>
221 :                         <cfthrow type="mock.invalidType" message="Argument #local.currentFunction.parameters[local.thisArg].name# of method #arguments.missingMethodName# in component #local.thisCFCName# is not of type #local.currentFunction.parameters[local.thisArg].type#." />
222 :                      <cfelseif not IsObject(arguments.missingMethodArguments[local.tempKey])>
223 :                         <cftry>

<!--- in /test.cfm --->
   mf = new coldmock.mockFactory();
   f = mf.createMock('com.util.factory');
   test = new com.util.test();

<!--- in /com/util/test.cfc--->
component accessors="true"
   property factory;
   string function method()
      return variables.factory.make(this);

<!--- in /com/util/factory.cfc--->
   string function make(required Test t)
      return "OK";
History: Created by henryho (Henry Ho) : 11/27/09 5:02 PM

Comment by henryho (Henry Ho) : 11/27/09 5:04 PM
This works though:

mf = new coldmock.mockFactory();
f = new com.util.factory();
test = new com.util.test();

To add a comment to this bug, please login using the link above.