R - Reason Codes
Introduction
These output codes are associated with checks performed on your Java code by Diffblue Cover and highlight code issues that prevent tests being created.
R002 - Missing observers
There are no fields that could be asserted on. Add getters or make the fields package-private.
R005 - Unable to load class
Please check that the class is available on your test runtime classpath. See our documentation for further guidance.
R006 - Static initializer failed
A static initializer threw an exception while trying to load a class. Make sure static initializers can be executed without throwing exceptions.
R007 - Class not accessible
Make sure all classnames are accessible from their targetPackage, for example by making them public.
R008 - Failed to instantiate class under test
Diffblue Cover was unable to construct an instance of someClass
. Ensure there is a package-visible constructor or factory method that does not throw an exception for the class under test. If such a method is already present but Diffblue Cover does not find it, it can be specified using custom rules for inputs: custom-inputs
See Working with code R008 for further troubleshooting of this issue.
R011 - Sandboxing policy violation
Diffblue Cover's default sandboxing policy disallowed test writing in order to prevent your code from damaging your system environment. Please see Working with code R011.
R012 - JNI sandbox policy violation
Diffblue Cover ran code in your project that tried to load a JNI library, violating the default security policy. See Java Native Interface to resolve this issue.
R013 - No inputs found that don't throw a trivial exception
Diffblue Cover tried to run the arrange/act section, but the method under test threw an error. Add constructors or factory methods that make it easier to construct fully initialized objects. Please see Working with code R013.
R018 - Trace file incomplete
The method under test could not be found in the execution trace. The trace file was only partially loaded because an error was found while loading it. Please record your application again with the Replay agent of your current installation of Cover.
R019 - Method not in trace
The method under test is not called in recorded execution trace. Record your program again and provide program inputs that trigger at least one call of the method under test.
R020 - Temporary files were created but not deleted
Please ensure that temporary files are deleted in the method under test.
R021 - Missing Spring component
Diffblue Cover detected Spring on the classpath, but failed to load critical components while building the Spring context. Make sure these components can be loaded.
R023 - Out of memory
Diffblue Cover failed to create tests because it ran out of memory. See: Memory Management
R026 - Failed to create Spring context
Failed to create Spring context. Check to see if there are any missing environment variables or system properties. For detailed and further troubleshooting please see Working with code R026.
R027 - Missing beans when creating Spring context
Failed to create Spring context due to missing beans. Check to see if there are any missing environment variables or system properties. Also missing beans could be defined in Spring profiles that aren't used for test generation. Otherwise, please contact Diffblue Support with details of the entire output message and the source code of the class under test.
R028 - Incomplete repository information
Try extending CrudRepository with concrete type parameters, or if the class should not be considered a repository then annotate the class with the @NoRepositoryBean
annotation.
R031 - Method may be time-sensitive
Diffblue Cover was only able to write tests that are time-sensitive. The assertions don't pass when run at an alternate date, time, and timezone. Try refactoring the method to take a java.time.Clock
instance so that the time can be parameterized during testing. See Working with code R031 for details.
R032 - User requested skeleton tests only
Only skeleton tests have been created for this method, as requested by the user. These should be completed manually, as needed.
R033 - Missing Spring properties
Some classes in the Spring context have @Value annotation that Diffblue Cover can't resolve. Usually variables for such annotations are provided in *.properties
files. Please check src/main/resources
and src/test/resources
. The default names for the files are application.properties
and application-test.properties
. If you use named Spring profiles please use application-<profile name>.properties
files.
R035 - Unsupported virtual threads call detected
Diffblue Cover does not support writing tests for methods that use virtual threads.
R036 - CSRF protection enabled
Controller tests cannot be written because CSRF protection is enabled by Spring-security. Write a custom configuration to deactivate CSRF for unit tests, which can then be imported in the base class for your test.
R037 - Unable to use annotation value
Diffblue Cover was unable to write a test using a value specified by an annotation.
R038 - Spring repository tests skipped
Diffblue Cover skipped test creation for Spring repository. Check whether Spring boot tests are enabled. If they are not, enable them.
R074 - Unable to create static mock
Mockito was unable to create a static mock for a class. Please review the underlying cause in the output message or log.
R081 - Exception in arrange section
Diffblue Cover was unable to construct an instance of the class under test because a step in the arrange section threw an exception.
R082 - Can't create a parameter for constructor
Diffblue Cover was unable to construct an instance. Diffblue Cover failed to create a parameter for the constructor or factory method call.
R083 - Can't find a suitable constructor
Diffblue Cover was unable to construct an instance. No suitable constructor or factory method found. Please check that the class under test has a non-private constructor or factory method.
R084 - Enum has no constants defined
Diffblue Cover was unable to test an instance of an enum as no constants are defined.
R085 - Unbounded loop in method under test
Diffblue Cover was unable to write a test that does not get into a potentially unbounded loop.
R086 - Unable to use custom base class
Diffblue Cover was unable to use the requested base class. Please check that the requested base class is public and has an accessible constructor.
R087 - Can't create required class instance
Diffblue Cover was unable to create an instance of a required class.
R088 - Method name is a reserved keyword
Diffblue Cover does not support methods with names that coincide with reserved keywords
Last updated