Skip to content

Commit 449a068

Browse files
committed
chore: fix tests
Signed-off-by: Stephane Bouchet <sbouchet@redhat.com>
1 parent 321e86c commit 449a068

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/test/java/com/redhat/devtools/intellij/MavenModuleImportingTestCase.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ protected void setUpFixtures() throws Exception {
4040
final JavaTestFixtureFactory factory = JavaTestFixtureFactory.getFixtureFactory();
4141
myProjectBuilder.addModule(JavaModuleFixtureBuilder.class);
4242
IdeaProjectTestFixture myFixture = factory.createCodeInsightFixture(myProjectBuilder.getFixture());
43-
myFixture.setUp();
4443
setTestFixture(myFixture);
44+
myFixture.setUp();
4545
LanguageLevelProjectExtension.getInstance(myFixture.getProject()).setLanguageLevel(LanguageLevel.JDK_17);
4646
}
4747

@@ -70,9 +70,16 @@ protected List<Module> createMavenModules(List<File> projectDirs) throws Excepti
7070
for(Module module : modules) {
7171
setupJdkForModule(module.getName());
7272
}
73+
7374
// Starting from IntelliJ 2024.2, indexing runs asynchronously in a background thread, https://plugins.jetbrains.com/docs/intellij/testing-faq.html#how-to-handle-indexing.
7475
// Use the following method to ensure indexes are fully populated before proceeding.
7576
IndexingTestUtil.waitUntilIndexesAreReady(project);
77+
// REVISIT: After calling setupJdkForModule() initialization appears to continue in the background
78+
// and a may cause a test to intermittently fail if it accesses the module too early. A 5-second wait
79+
// is hopefully long enough but would be preferable to synchronize on a completion event if one is
80+
// ever introduced in the future.
81+
Thread.sleep(5000L);
82+
7683
return Arrays.stream(modules).skip(1).toList();
7784
}
7885

@@ -104,6 +111,6 @@ protected Module createMavenModule(String name, String xml) throws Exception {
104111
}
105112

106113
protected IPsiUtils getJDTUtils() {
107-
return PsiUtilsLSImpl.getInstance(getTestFixture().getProject());
114+
return PsiUtilsLSImpl.getInstance(getProject());
108115
}
109116
}

src/test/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/PropertiesManagerLocationTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package com.redhat.devtools.intellij.lsp4mp4ij.psi.core;
1111

1212
import com.intellij.openapi.module.Module;
13-
import com.redhat.devtools.intellij.MavenModuleImportingTestCase;
1413
import com.redhat.devtools.intellij.lsp4mp4ij.psi.internal.core.ls.PsiUtilsLSImpl;
1514
import org.eclipse.lsp4j.Location;
1615
import org.junit.Assert;

src/test/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/config/properties/MicroProfileConfigPropertyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void testConfigQuickstartFromClasspath() throws Exception {
4242
File f = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-core-deployment:1.1.0.Final"), "jar").toFile();
4343
assertNotNull("Test existing of quarkus-core-deployment*.jar", f);
4444

45-
assertProperties(infoFromClasspath, 244 /* properties from JAR */ + //
45+
assertProperties(infoFromClasspath, 240 /* properties from JAR */ + //
4646
31 /* properties from Java sources with ConfigProperty */ + //
4747
2 /* properties from Java sources with ConfigRoot */ + //
4848
7 /* static properties from microprofile-context-propagation-api */ +

0 commit comments

Comments
 (0)