Reflection operation has failed.: Please check that your test runtime classpath is complete; in particular, check that you do not have any dependency exclusions configured

Getting the following when trying to generate test cases using IntelliJ + SBT + Play Framework. Using Java8, the program compiles fine. I am however using sdkman to manage this and the plugin isn’t clear about where its reading the classpath / dependency exclusion from. The linked wiki doesn’t mention this error and no relevant hits on Google…

16:42	Build completed successfully in 2 sec, 54 ms

16:42	Commencing test creation: Analyzing 5 methods in total

16:42	Logfile location: /var/folders/fz/wh9pdq110f5cqtyqm9vvbbgw0000gn/T/diffblue/log/cover-plugin.log

16:42	Reflection operation has failed.: Please check that your test runtime classpath is complete; in particular, check that you do not have any dependency exclusions configured. See https://diff.blue/E005

Hi Pete_bigger,

Thanks for getting in touch with us. The plugin gets the class-path information from the project configuration via IntelliJ. You can access this via the shortcut command + ; on Mac, or control + ; on linux (Project settings—IntelliJ IDEA). One other thing to check is to make sure your project compiles in IntelliJ.

Before generating tests, the plugin will use the IDE to build your project (so we have the latest changes to write tests for).

Please let us know how you get on.

Yep it’s all set correctly and builds/runs fine.

Hi @Pete_bigger I was able to reproduce this error once and then could not reproduce it anymore. What helped for me was closing the project in IntelliJ and then reopening it and waiting for the indexing to complete. Would you be able to try this? Thanks Andy

Restarted IntelliJ, cleared and invalidated cache’, tried it with both building with Play and SBT enabled. Updated DiffBlue plugin, Issue persists.

Hi @Pete_bigger, are you able to share the project with us or is this internal code - just wondering if there is an easy way to reproduce this? Many Thanks Andy

Hi @Pete_bigger I have reproduced a version of this. It happened for me when the IntelliJ project would not compile because of incorrect Java code - we will investigate on that basis, but I am presuiming your code does actually compile under IntelliJ?

Just noticed the DiffBlue logs actually say it compiles successfully too as seen in the log file below.

The project is available here: GitHub - glasgowm148/Calamity: HelpMe!: Identifying emergency reports and calls for help on social media

   20/03/2021
11:58	Plugin updates installed: Diffblue Cover Community Edition - Unit Test Generator, Scala, Tabnine AI Autocomplete: JavaScript C Python Ruby Rust Go PHP...

12:00	Build completed successfully in 8 sec, 264 ms

12:01	2 private methods found: Tests cannot be generated for adapterVector, convertTable

12:01	All files are up-to-date

12:01	Commencing test creation: Analyzing 4 methods in total

12:01	Logfile location: /var/folders/fz/wh9pdq110f5cqtyqm9vvbbgw0000gn/T/diffblue/log/cover-plugin.log

12:01	Creating tests for method: AdapterFeatures.<init>

12:01	Reflection operation has failed.: Please check that your test runtime classpath is complete; in particular, check that you do not have any dependency exclusions configured. See https://diff.blue/E005