Using clashing versions of external libraries when unit-testing
IntelliJ uses protobuf v2.5.
My plugin uses protobuf v3.x.
This is not a problem when regularly running the plugin, just as promised. However, when unit-testing using IntelliJ's provided *TestCase classes, it seems that the special class loader implementation is not used. VerifyError-s and NoSuchMethodError-s prevent the unit test from running properly.
Can someone please advise on how unit tests may be run?
Please sign in to leave a comment.
Hi,
ensure that your library comes to the classpath before the IDEA SDK then your library would replace one, provided by IDEA
Anna
Hello Anna,
To clarify, the errors generated are *because* the library replaces the ones IDEA uses.
For example, the VerifyError presents itself because `org.jetbrains.jps.api.CmdlineRemoteProto$Message`, which is part of the IDEA SDK, overrides isInitialized(), an inherited protobuf library method that is okay to override within the old version of the protobuf library that IDEA uses, but may not be overridden in the version that I am using, because it is marked final within the new version of the library.
How do I perform unit-testing?
P.S.: This particular error occurs even when "-noverify" is specified in the IDE's Java compiler settings (presumably because of the "unit test runner" mechanics that I'm unfamiliar with).
I suppose the month of silence means unit-testing isn't directly supported?