0

Since we upgraded the flex sdk in our application to 4.10 we've been running into Verify Errors while running unit tests that use mockolate.

They seem to occur when mocking an interface where a ByteArray is used in a method signature.

Example interface:

public interface IFileSystemHelper {

    function loadFileContents(path:String):ByteArray;

}

Example test class:

public class SomeTest {

    [Rule]
    public var mockolateRule:MockolateRule = new MockolateRule();

    [Mock]
    public var fileHelper:IFileSystemHelper;

    public function SomeTest() {
    }

    [Test]
    public function testMethod():void {
        // ...
    }
}

When compiling and running the test with flexmojos 6.0.1 the following error is thrown:

VerifyError: Error #1053: Illegal override of IFileSystemHelper8F2B5D281827800A824B85B588C6F2A08AE814ED in mockolate.generated.IFileSystemHelper8F2B5D281827800A824B85B588C6F2A08AE814ED

My initial suspicion was an sdk version problem with playerglobal (or airglobal in our case) so i recompiled mockolate (and flexunit) with sdk 4.10, without any result.

The only thing that seems to work is to remove the ByteArray type from the method signature... but that's not really an option :-) (and this has never been a problem before)

Is there anyone who has had a similar issue?

Thanks

Bert
  • 257
  • 1
  • 2
  • 10
  • So I guess you have an interface IFileSystemHelper and mockolate is generating a class to "implement" the mock. Can you actually see the generated code somewhere? Judging from this other post http://stackoverflow.com/questions/4450302/mockolate-suddenly-getting-verifyerror-illegal-override eventually your problem is that you changed the signature of IFileSystemHelper, but the generated mock code hasn't been updated? Therefore the old generated class would do an illegal override, because the signatures don't match? – Christofer Dutz Jan 09 '14 at 08:59
  • The signature of that method hasn't changed, nor has the test. I haven't looked at the generated code though, i'll give that a go first, thx for the pointer! :-) – Bert Jan 09 '14 at 10:11
  • Nothing odd to see on the generated sources and signatures i'm afraid – Bert Jan 09 '14 at 10:19
  • Guess it would be a good idea to contact the mockolate guys ... I would assume that they know what's going wrong or at least how to track the problem down. For now I would assume that the problem is not directly related to the newer Flex SDK version, the Mavenizer or Flexmojos itself, but more to how Mockolate does stuff ... unfortunately that's a black box for me. – Christofer Dutz Jan 09 '14 at 10:48

1 Answers1

0

This problem usually occurs when compiling different parts of your application with different versions of the sdk.

I would recommend to have a look at the output of "mvn dependency:tree" as this should output all dependencies (direct and transitive ones). Perhaps this will help you find where the wrong version is comming from.

Christofer Dutz
  • 2,305
  • 1
  • 23
  • 34
  • Hey Chris, that was my first guess too, but checking the dependencies didn't result in much :-). – Bert Jan 08 '14 at 20:34
  • I even isolated the problem in a separate project, using only the necessary flex & air dependencies, mockolate & flexunit. (so ruling out any issue with other dependencies). I only added the example interface & test i mentioned above, but without any luck. – Bert Jan 08 '14 at 20:46
  • Another problem could be that you are using rsls or normal libs that have included framework classes (Sort of statically linked libs) but I guess this is a little more tricky to find out. You could use IntelliJ to tell you where it gets the ByteArray class from. If it finds this in more than one, you're in trouble. I don't know if FB is able to do this. If not opening the libs with a zip tool and having a look at the manifest should help. Judging from your second comment, perhaps mockolate is including a sataically linked class? – Christofer Dutz Jan 09 '14 at 08:48
  • IntelliJ only points me to one ByteArray class in the airglobal swc (the right one). I've inspected mockolate's manifest & link report when recompiling against the 4.10 sdk, but I couldn't find any script tags referencing framework code (only dependency tags and externals). This is turning out to be a real doozy :-). In any case thanks for your help on this, and all your great work on FlexMojos! – Bert Jan 09 '14 at 10:39