Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the build with IDEA 12.1 jars fails tests #27

Closed
aheusingfeld opened this issue Feb 20, 2013 · 2 comments
Closed

Running the build with IDEA 12.1 jars fails tests #27

aheusingfeld opened this issue Feb 20, 2013 · 2 comments
Labels

Comments

@aheusingfeld
Copy link
Collaborator

When running your version of "https://github.com/gshakhn/ideauidesigner-maven-plugin" modified with jars of IDEA 12.1 (LEDA 126.232) the unit tests for sonar-intellij-plugin fail:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.sonar.ide.intellij.model.ViolationTableModelTest
Tests run: 7, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.202 sec <<< FAILURE!
Running org.sonar.ide.intellij.ui.FileNamesToolTipBuilderTest
Tests run: 4, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.007 sec <<< FAILURE!

Results :

Tests in error: 
  testRowCount(org.sonar.ide.intellij.model.ViolationTableModelTest)
  testCurrentVirtualFile(org.sonar.ide.intellij.model.ViolationTableModelTest): Could not initialize class com.intellij.testFramework.LightVirtualFile
  settingViolationsOrSourceWithADifferentVirtualFileResetsOther(org.sonar.ide.intellij.model.ViolationTableModelTest): Could not initialize class com.intellij.testFramework.LightVirtualFile
  testValueAt(org.sonar.ide.intellij.model.ViolationTableModelTest): Could not initialize class com.intellij.testFramework.LightVirtualFile
  testGenerateToolTipFromListWithOneRealElement(org.sonar.ide.intellij.ui.FileNamesToolTipBuilderTest): Could not initialize class com.intellij.testFramework.LightVirtualFile
  testGenerateToolTipFromListWithMoreRealElements(org.sonar.ide.intellij.ui.FileNamesToolTipBuilderTest): Could not initialize class com.intellij.testFramework.LightVirtualFile

Tests run: 11, Failures: 0, Errors: 6, Skipped: 0

I'll investigate further on this.

@aheusingfeld
Copy link
Collaborator Author

testRowCount() fails with the following exception. Any help is appreciated!
NOTE:
I ran "./install-intellij-libs.sh /Users/ahe/Applications/Leda-IU-128.101.app/" prior to executing the tests to have the latest jars for IDEA 12.1

java.lang.ExceptionInInitializerError
    at org.sonar.ide.intellij.model.ViolationTableModelTest.testRowCount(ViolationTableModelTest.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.NullPointerException
    at com.intellij.openapi.vfs.DeprecatedVirtualFileSystem.startEventPropagation(DeprecatedVirtualFileSystem.java:32)
    at com.intellij.testFramework.LightVirtualFile$MyVirtualFileSystem.<init>(LightVirtualFile.java:130)
    at com.intellij.testFramework.LightVirtualFile$MyVirtualFileSystem.<init>(LightVirtualFile.java:126)
    at com.intellij.testFramework.LightVirtualFile.<clinit>(LightVirtualFile.java:184)
    ... 28 more

@aheusingfeld
Copy link
Collaborator Author

Ok, solved it! In tests touching application classes you need to initialize the environment. But we forgot to do this in the tests:

    private PlatformUltraLiteTestFixture myFixture;

    @Before
    public void setUp() {
        myFixture = PlatformUltraLiteTestFixture.getFixture();
        myFixture.setUp();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant