Links

Working with code R005

R005 - Unable to load class
The output code R005 generally means that we tried to load a class (e.g. a parameter type) in order to write a test, but failed to do so. This can occur in the context of unit tests for Spring, Java Enterprise Edition (and a few other examples) since some Maven/Gradle dependencies are not available at test scope.
An additional reason that classes fail to load can be when the class in question has previously caused an R006 because the static initializer failed to run - often because it attempted to perform an I/O operation that Cover blocked, or timed out. If you've also seen an R006 for the same class then try to address that first by minimizing static initializer logic.

What’s a scope?

A Maven pom.xml file or a Gradle build script (build.gradle or build.gradle.kts) specifies the steps necessary to create a software artifact from the source code. This includes managing the dependencies on third-party libraries and frameworks. Both Maven and Gradle allow us to define different groups of dependencies. These dependency groups are called "scopes" in Maven and "configurations" in Gradle. Diffblue Cover uses test scopes / configurations.

Maven Scope Dependencies

The dependency scopes available to Diffblue are: compile (default), runtime, test and provided. However, the provided scope is not transitive, which may be a cause of R005 errors. If Diffblue Cover reports that a class indirectly included by a dependency is missing, you can try to resolve this issue by including an additional reference to this indirect dependency at test scope.
For further information on Maven dependency scopes, please see: Maven dependencies

Gradle Configuration Dependencies

Again, you must use the correct dependency configurations to avoid receiving the output code R005.
For further information on Gradle dependency configurations, please see: Gradle Configuration Dependencies