Skip to content

Commit

Permalink
chore: attempt to fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jansorg committed Feb 19, 2025
1 parent d1815bb commit 4eafd0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package appland.toolwindow.appmap;

import appland.AppMapBaseTest;
import appland.utils.ModuleTestUtils;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
Expand All @@ -23,7 +22,7 @@ protected TempDirTestFixture createTempDirTestFixture() {
@Override
protected boolean runInDispatchThread() {
return false;
}
}

@Test
public void emptyAppMaps() {
Expand Down
14 changes: 5 additions & 9 deletions plugin-core/src/test/java/appland/utils/ModelTestUtil.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package appland.utils;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.testFramework.EdtTestUtil;
import com.intellij.ui.tree.AsyncTreeModel;
import com.intellij.ui.tree.TreeTestUtil;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ui.EDT;
import com.intellij.util.concurrency.ThreadingAssertions;
import org.jetbrains.annotations.NotNull;

import javax.swing.tree.TreeModel;
Expand All @@ -17,13 +17,9 @@ private ModelTestUtil() {
public static void assertTreeHierarchy(@NotNull TreeModel model,
@NotNull String expected,
@NotNull Disposable disposable) {
if (EDT.isCurrentThreadEdt()) {
assertTreeHierarchyOnEDT(model, expected, disposable);
} else {
ApplicationManager.getApplication().invokeAndWait(() -> {
assertTreeHierarchyOnEDT(model, expected, disposable);
});
}
ThreadingAssertions.assertBackgroundThread();

EdtTestUtil.runInEdtAndWait(() -> assertTreeHierarchyOnEDT(model, expected, disposable));
}

private static void assertTreeHierarchyOnEDT(@NotNull TreeModel model,
Expand Down

0 comments on commit 4eafd0b

Please sign in to comment.