Skip to content

Commit

Permalink
Ignore 'Already disposed: Project' error in UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelLipski committed Mar 1, 2021
1 parent eac5243 commit 19e8a7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import com.tngtech.archunit.core.domain.JavaMethodCall;
import org.junit.Test;

import com.virtuslab.gitmachete.frontend.actions.base.BaseProjectDependentAction;

public class ClassStructureTestSuite extends BaseArchUnitTestSuite {

@Test
Expand All @@ -29,9 +27,9 @@ public void actions_implementing_DumbAware_should_extend_DumbAwareAction() {
public void actions_overriding_onUpdate_should_call_super_onUpdate() {
classes()
.that()
.areAssignableTo(BaseProjectDependentAction.class)
.areAssignableTo(com.virtuslab.gitmachete.frontend.actions.base.BaseProjectDependentAction.class)
.and()
.areNotAssignableFrom(BaseProjectDependentAction.class)
.areNotAssignableFrom(com.virtuslab.gitmachete.frontend.actions.base.BaseProjectDependentAction.class)
.and(new DescribedPredicate<JavaClass>("override onUpdate method") {
@Override
public boolean apply(JavaClass input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ import org.virtuslab.ideprobe.ide.intellij.IntelliJFactory
trait RunningIntelliJPerSuite extends RunningIntelliJPerSuiteBase {
@BeforeClass override final def setup(): Unit = super.setup()

private val ignoredErrorMessages = Seq(
// Spurious errors in the IDEA itself (probably some race conditions)
"com.intellij.diagnostic.PluginException: Cannot create class com.intellij.uast.UastMetaLanguage",
"com.intellij.serviceContainer.AlreadyDisposedException: Already disposed: Project",
// https://github.com/VirtusLab/ide-probe/issues/95
"scala.MatchError: IDE_UPDATE (of class com.intellij.notification.NotificationType)"
)

@AfterClass override final def teardown(): Unit = {
try {
super.teardown()
} catch {
case e: Exception =>
val filteredSuppressed = e.getSuppressed.filterNot { s =>
// A duct tape to ignore https://github.com/VirtusLab/ide-probe/issues/95
s.getMessage.contains("scala.MatchError: IDE_UPDATE (of class com.intellij.notification.NotificationType)") ||
// Another duct tape to ignore a spurious error in the IDEA itself (probably some race condition)
s.getMessage.contains("com.intellij.diagnostic.PluginException: Cannot create class com.intellij.uast.UastMetaLanguage")
ignoredErrorMessages.exists(s.getMessage.contains)
}
if (filteredSuppressed.nonEmpty) {
// Following the approach taken by org.virtuslab.ideprobe.reporting.AfterTestChecks.apply
Expand Down

0 comments on commit 19e8a7a

Please sign in to comment.