Skip to content

Instantly share code, notes, and snippets.

@drewbourne
Created March 2, 2011 22:32
Show Gist options
  • Save drewbourne/851909 to your computer and use it in GitHub Desktop.
Save drewbourne/851909 to your computer and use it in GitHub Desktop.
package org.mockolate.issues
{
import flash.external.ExternalInterface;
public class JSBridge
{
private static var instance:JSBridge;
private static var allowInstantionation:Boolean;
public static function getInstance():JSBridge
{
if (instance)
{
return JSBridge.instance;
}
else
{
allowInstantionation = true;
instance = new JSBridge()
allowInstantionation = false;
return instance;
}
}
public function JSBridge()
{
super();
}
public function send(... arguments):void
{
ExternalInterface.call.apply(null, arguments);
}
}
}
package org.mockolate.issues
{
import mockolate.runner.MockolateRule;
public class JSBridgeTest
{
[Rule]
public var mocks:MockolateRule = new MockolateRule();
[Mock(type="strict")]
public var jsBridge:JSBridge;
[Test]
public function testPanelOpenJS():void
{
var delegate:PanelOpenDelegate = new PanelOpenDelegate();
mocks.mock(jsBridge).method("send").args("prOpenPanel", 1, "CID");
delegate.jsBridge = jsBridge;
delegate.openPanelJS(1, "CID");
}
}
}
package org.mockolate.issues
{
public class PanelOpenDelegate
{
public var jsBridge:JSBridge;
public function openPanelJS(id:int, name:String):void
{
jsBridge.send("prOpenPanel", id, name);
}
}
}
@slackmage
Copy link

Drew, same error

Error: No Mockolate for that target, received:

Could this be tied to flexmojos method running tests in maven somehow?

@drewbourne
Copy link
Author

It is quite possible that FlexMojos isn't doing the right thing.

We're using these versions:

  • FlexMojos 4.0-beta-3
  • Mockolate 0.10.0

And FlexUnit with these dependencies:

<!-- flexunit -->
<dependency>
  <groupId>org.flexunit</groupId>
  <artifactId>flexunit-core-flex</artifactId>
  <version>4.1.0</version>
  <type>swc</type>
  <scope>compile</scope>
</dependency>

<dependency>
  <groupId>org.flexunit</groupId>
  <artifactId>flexunit-cilistener</artifactId>
  <version>4.1.0</version>
  <type>swc</type>
  <scope>compile</scope>
</dependency>

<dependency>
  <groupId>org.flexunit</groupId>
  <artifactId>flexunit-uilistener</artifactId>
  <version>4.1.0</version>
  <type>swc</type>
  <scope>compile</scope>
</dependency>

<dependency>
 <groupId>com.adobe.flexunit</groupId>
 <artifactId>flexunit</artifactId>
 <version>4.0-beta-2</version>
 <type>swc</type>
 <scope>test</scope>
</dependency>

@mikeycmccarthy
Copy link

Hey Drew,

Do you have mockolate on a maven repository somewhere or do you just have it installed locally?

Thanks,
Michael

@drewbourne
Copy link
Author

drewbourne commented May 5, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment