Hi,
it would be great if someone with more insight into the project
infrastructure of NetBeans, especially with Gradle, could have a look
at the unittest
org.netbeans.modules.gradle.java.classpath.ClassPathProviderImplTest
When I run it manually, I get failures every 5-10 runs on JDK 8 in
testCompilePreTrusted. If I switch testing to JDK 11, I get the same
error every time. The error can be reproduced even if the test method
is ran in isolation.
The logs are not to helpful (identical between successful and failing
run).
I modified the test like this (reporting the detected quality in the
fal message):
-----------------------------------------------------------------
---
a/java/gradle.java/test/unit/src/org/netbeans/modules/gradle/java/classpath/ClassPathProviderImplTest.java
+++
b/java/gradle.java/test/unit/src/org/netbeans/modules/gradle/java/classpath/ClassPathProviderImplTest.java
@@ -36,6 +36,7 @@
import org.netbeans.modules.gradle.AbstractGradleProjectTestCase;
import org.netbeans.modules.gradle.ProjectTrust;
import org.netbeans.modules.gradle.api.NbGradleProject;
+import org.netbeans.modules.gradle.api.NbGradleProject.Quality;
import org.netbeans.modules.gradle.java.api.GradleJavaProject;
import org.netbeans.spi.java.classpath.ClassPathProvider;
import org.netbeans.spi.project.ActionProgress;
@@ -249,7 +250,8 @@
FileObject j2 = s.getFileObject("src/main/java/test/App.java");
NbGradleProject ngp = NbGradleProject.get(prj2);
- assertTrue("Closed project should be at least EVALUATED",
ngp.getQuality().atLeast(NbGradleProject.Quality.EVALUATED));
+ Quality evaluatedQuality = ngp.getQuality();
+ assertTrue("Closed project should be at least EVALUATED, but was: " +
evaluatedQuality, evaluatedQuality.atLeast(NbGradleProject.Quality.EVALUATED));
ClassPath cp = ClassPath.getClassPath(j2, ClassPath.COMPILE);
assertFalse("Cached project must know its COMPILE path",
cp.getRoots().length == 0);
-----------------------------------------------------------------
With that I get:
Testcase:
testCompilePreTrusted(org.netbeans.modules.gradle.java.classpath.ClassPathProviderImplTest):
FAILED
Closed project should be at least EVALUATED, but was: FALLBACK
junit.framework.AssertionFailedError: Closed project should be at least
EVALUATED, but was: FALLBACK
at
org.netbeans.modules.gradle.java.classpath.ClassPathProviderImplTest.testCompilePreTrusted(ClassPathProviderImplTest.java:254)
at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:77)
at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:476)
at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:402)
at java.lang.Thread.run(Thread.java:748)
Given the comments about a cache, we might see a cached version, which
is in the closed state.
Thank you
Matthias
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists