Partial test written with an R013 result code

Hi,
when trying the diffblue plugin in Intellij it is writing a partial test. The problem line is where a method of an object which is a field of the class under test is called. diffblue is instantiating this object rather than mocking it and the test then gets a NullPointerException when a method is called on the object. Although the object can be constructed it does lookups when its methods are called so would normally need a Spring context to work.

Is there a way to tell diffblue that this class and its methods should be mocked?
There is some documentation on custom inputs and creating a DiffblueBase class but I think this is for use with cover cli. In my first experiment the base class wasn’t used.

Hi Ben,

Thank you for contacting Diffblue Support. As you correctly noticed the --mock option applies to CLI. However, please check the plugin settings and you will find a similar option. Irrespective to which version you use, CLI or plugin, these video tutorials should help you deal with R013 codes

Like all R codes, R013 is not a runtime errorsl. It only flags untestability of your code. Please let us have a log file from the Diffblue run where you see the R013 code and we will try to help. You should see the path to such log file, in the IntelliJ console.

Kind regards,
Cristian