Menu

#31 Error thrown when attempting to stub WebService

1.0
open
nobody
Recording (6)
5
2011-04-27
2011-04-27
Mike Stead
No

I'm using ASMock 1.0 with FlexUnit-4.1.0_RC2 and attempting to stub a mx.rpc.soap.WebService like so:

[Rule] public var includeMocks:IncludeMocksRule = new IncludeMocksRule([WebService]);

[Before]
public function setUp():void
{
var mockRepository:MockRepository = new MockRepository();
var service:WebService = WebService(mockRepository.createStub(WebService));
}

and get the following error:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
at org.floxy::InterceptorProxyListener/methodExecuted(InterceptorProxyListener.as:54)
at asmock.generated::WebServiceEA4F453CAF635AF9FDC8E324ECE9DD1416578FEC/addEventListener
at asmock.framework::MockRepository/stubEvents(MockRepository.as:681)
at asmock.framework::MockRepository/createStub(MockRepository.as:216)
**[ at com.somedomain.login::LoginTaskTest/setUp(LoginTaskTest.as:39) ]
at Function/http://adobe.com/AS3/2006/builtin::apply
at flex.lang.reflect::Method/apply(Method.as:244)
at org.flexunit.runners.model::FrameworkMethod/invokeExplosively(FrameworkMethod.as:201)
at org.flexunit.internals.runners.statements::InvokeMethod/evaluate(InvokeMethod.as:72)
at org.flexunit.internals.runners.statements::SequencerWithDecoration/executeStep(SequencerWithDecoration.as:100)
at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete(StatementSequencer.as:141)
at org.flexunit.internals.runners.statements::StatementSequencer/evaluate(StatementSequencer.as:109)
at org.flexunit.internals.runners.statements::RunBeforesInline/evaluate(RunBeforesInline.as:70)
at org.flexunit.internals.runners.statements::RunAftersInline/evaluate(RunAftersInline.as:77)
at org.flexunit.internals.runners.statements::MethodRuleBase/proceedToNextStatement(MethodRuleBase.as:50)
at Function/asmock.integration.flexunit:IncludeMocksRule/org.flexunit.internals.runners.statements:IAsyncStatement:evaluate/asmock.integration.flexunit:repositoryPreparedHandler(IncludeMocksRule.as:119)
at flash.events::EventDispatcher/dispatchEventFunction
at flash.events::EventDispatcher/dispatchEvent
at Function/org.floxy:ProxyRepository/org.floxy:IProxyRepository:prepare/org.floxy:swfLoadedHandler(ProxyRepository.as:218)

Discussion

  • Richard Szalay

    Richard Szalay - 2011-04-27

    Hi Mike,

    That's a very strange error - it looks like it can't find a class within floxy (asmock's dynamic proxy generation framework)

    Do you have any other mocking tests? (it seems like this would fail for everything)

    What version of the Flex SDK are you using? It might be worth re-compiling flemit/floxy/asmock from source using the same version of the SDK.

     
  • Richard Szalay

    Richard Szalay - 2011-04-27
    • labels: 1165886 --> Recording
     
  • Mike Stead

    Mike Stead - 2011-04-28

    Hey Richard, I'm using Flex 4.1.

    I've recompiled from source both ASMock and ASMockFlexUnit41 and still get the same error. I can seem to mock other classes ok.

    I attempted to attach a small example project but there's a limit to upload size so I've sent you a PM.

    Cheers,
    Mike

     
  • Richard Szalay

    Richard Szalay - 2011-05-04

    Hi Mike,

    I've still not received that PM. You can try sending it to me directly at <firstname> @ <firstname> <lastname> .com

    There's no spaces or dots between words.

    Cheers,
    Richard

     
  • Richard Szalay

    Richard Szalay - 2011-05-04

    Btw, if you can mock other objects you might consider abstracting WebService using an interface and mocking that to workaround the problem until I see fix the source.

     
  • Mike Stead

    Mike Stead - 2011-05-10

    Hey Richard, sorry for the delay. I've emailed through the test project. Let me know if you don't receive it.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.