ASMock: VerifyError for flash.net.NetGroup

276 Views Asked by At

I have been using ASMock in combination with Flexunit4.1 to create automated tests for my project. However, when I tryto mock a flash.net.NetGroup I get the following error message:

VerifyError: Error #1053: Illegal override of NetGroup6B54B8B32216E97DF75A0EBB17879E26E9B81916 in asmock.generated.NetGroup6B54B8B32216E97DF75A0EBB17879E26E9B81916.

after I added it to the [Rule] like so:

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

I figured this error had something to do with compiling with different versions (NetGroup has been introduced not that long ago) so I pulled ASMock and all it's dependency projects from their respective SVN/Git repositories and rebuild them all. The list of projects is:

  • ASMock
  • ASMockFlexUnit4
  • ASMockFlexUnit41
  • FLemit
  • FLexUnit (original Adobe one, used by Flexunit4)
  • Flexunit4
  • FlexUnit4UIListener
  • FLoxy
  • hamcrest

These are all loaded in my workspace and dynamically linked to each other. Now I have no dependencies left on any pre-build SWC file whatsoever and all projects are build using the current compiler and the 4.6.0 SDK. (some of these projects had not been recompiled since SDK 2.x so I had high hopes).

So I reran my tests and got the following error:

return types dont match
   virt * flash.net::NetGroup/set receiveMode()
   over void asmock.generated::NetGroup6B54B8B32216E97DF75A0EBB17879E26E9B81916/set receiveMode()

VerifyError: Error #1053: Illegal override of NetGroup6B54B8B32216E97DF75A0EBB17879E26E9B81916 in asmock.generated.NetGroup6B54B8B32216E97DF75A0EBB17879E26E9B81916.

So, apparently the problem was not to do with SWC files with different SDK versions. Can anyone point me in the right direction so resolve this issue because I would really like to mock NetGroups (and custom child classes) to test my project properly.

Miscellaneous information: For all projects the minimum required flash player is set to 11.1.0 (the minimum for SDK 4.6.0).

Thanks in advance

1

There are 1 best solutions below

0
On

TBH, I've not worked on asMock for some time (I'm not involved with any Flash work anymore), but I'll help as much as I can.

Having said that, the first thing that jumps out at me is that NetGroup could be marked as final. Overriding final classes (and methods, for that matter) via bytecode has behaved differently over the various Flash Player versions, but it stopped working in FP10.

If all else fails, I'd recommend creating an abstraction of it (INetGroupFacade) and depending on that.