Knowledge Base > Troubleshooting > Working with code R013
Working with code R013
If you receive the output message R013, this means that Diffblue Cover CLI DCover cannot write tests for a method because it is unable to find ‘useful’ inputs to provide to the method. Please consider the parameters of the method under test, along with the class variables and instance variables it uses to ensure that it is possible to set reasonable values for these quantities.
Examples of possible causes of code R013
Check whether any problems similar to the following could be occurring in the method under test.
1. Inaccessible constructor for class required as argument
public class PassAsArgument() {
private PassAsArgument() {}
}
public class SomeClass() {
public static Object acceptArgument(PassAsArgument passAsArgument) {
// Do processing
}
}
There are three solutions to the scenario above: make the PassAsArgument
constructor public, provide a static factory method which returns an instance of PassAsArgument
, or provide a publicly accessible default instance.
2. The method uses a private member with an unset or bad value
public class SomeClass() {
private Runnable value;
// ...
public int runSomething() {
// ...
value.run();
// ...
}
}
Again, there are three solutions to this scenario. Ensure that value
is initialised with a proper value, make value
public or provide a getter and a setter for value
.