Unit-Tests and JDK

The following code fails in my unit-tests, because getCanonicalText() returns "String" instead of "java.lang.String":


Calling com.intellij.testFramework.builders.JavaModuleFixtureBuilder#addJdk resolves this issue, but test run times increase massively. Do I really need to do this or is there some error with my test setup? I see Spring plugin uses the same code as above without explicitly adding a JDK for the tests.

Thanks,
Yann

4 comments

No hints?

On a sidenote: I don't get this working on my Mac (running Leopard),


doesn't work..

0

Hello Yann,

could there be a difference between compiled classes and source-only classes? In the latter one IDEA wouldn't know that "String something() { ... }" returns a java.lang.String without having the classes from a JDK, while for a compiled class the qualified names are known. Just a guess.

Sascha

0

Hi Sascha,

yes that's true, still I wonder why Spring-plugin doesn't need to setup a JDK for its tests using exactly the same piece of code I posted in my first message. So either there must be some hidden parameters to plugin run configuration or something else I missed..

Greetings,
Yann

0

answering myself (once again..)

using

instead of comparing the type-names did the trick

0

Please sign in to leave a comment.