Test generation failed Cause: java.lang.NoClassDefFoundError: java/lang/Record

Hi,

I am testing DiffBlue Trial and I cannot generate tests for Java 17. Spring-boot 2.7.11

I am getting

Internal error: Test generation failed Cause: java.lang.NoClassDefFoundError: java/lang/Record at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at com.diffblue.cover.sandbox.b.a.findClass(SourceFile:114) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:398) at com.diffblue.c.a.a(SourceFile:286) at com.diffblue.tir.e.a.f.b(SourceFile:158) at com.diffblue.tir.e.a.f.a(SourceFile:79) at com.diffblue.tir.e.a.f.a(SourceFile:63) at com.diffblue.tir.e.b.a.a(SourceFile:87) at com.diffblue.tir.e.b.a.visitEnd(SourceFile:73) at com.diffblue.shaded.org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:206) at com.diffblue.shaded.org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:240) at com.diffblue.shaded.org.objectweb.asm.signature.SignatureReader.accept(SignatureReader.java:122) at com.diffblue.tir.r.e(SourceFile:5214) at com.diffblue.tir.r.a(SourceFile:391) at com.diffblue.tir.d.g$12.loadStep(SourceFile:177) at com.diffblue.tir.r.a(SourceFile:2301) at com.diffblue.tir.u.a(SourceFile:94) at com.diffblue.cover.analysis.a.d.a(SourceFile:130) at com.diffblue.cover.analysis.a.c$a.tryAdvance(SourceFile:153) at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326) at com.diffblue.cover.b.b.b.a(SourceFile:445) at com.diffblue.cover.b.b.e.a(SourceFile:144) at com.diffblue.cover.j.a.b.a(SourceFile:177) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

Testing dependencies

<dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.8.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.8.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.8.2</version>
        </dependency>

Any idea how to fix it?

Hi @Szuchow
Thanks for getting in touch and for trying Diffblue Cover.
Can you confirm which version of Diffblue Cover you are using? (Support for Java 17 Records was added in 2023.07.03).
If you are already using that version or later, please could you send us the whole Diffblue support log file for CLI or IntelliJ Plugin depending on which product you are using?
Please feel free to email it to us via support@diffblue.com instead of on this Forum if you prefer.

Best regards
Peter Sear @ Diffblue

That was it. I’ve upgraded Intellij to 2023.2.1 and Diffblue works like a charm on java 17. Thank you!

2 Likes