@Service in Spring with no Getters and Setters some test generated and works Ok but others dont

I am getting Reason: R013 No inputs found that don’t throw a trivial exception in a @Service in Spring. This @Service doesn’t have any setters and getters . I got another tests and it works Ok but in two cases gave this error. I read this Working with code R013 | Diffblue Docs . And it looks like I need to change the service to get the test to work. Any ideas?

Hi grojas123,

We are glad to see you trying Diffblue Cover. The R013 code is not an error. It is just one of the many output codes issued by Diffblue Cover when a method cannot be tested. With these codes we help users to understand why tests cannot be written and suggest actions to take.

Please take a look at the log files. If you run the IntelliJ plugin this is located for example in Windows at: C:\Users\user\AppData\Local\Temp\diffblue\log\ and if you use the CLI version, you should find it in the .diffblue\log folder at the project root level. Identify the method which threw the R013 code and read the partial test written. You might need to search in both the user log and the support log.

In most of the cases the R013 comes because an exception is thrown while Diffblue Cover tries to assemble a unit test and this is why the test remains a @Disable partial test without an assertion. There are as many reasons for getting an R013 code as exception types exist.

We would be happy to investigate this issue for you if you send us the support log file and mention which method remains untested. A code snippet of that method would also help.

Kind Regards,

Thank for your response.
I got it what R013 means . Attached the logs
support-20230316T155838.log (55.2 KB)
user-20230316T155838.log (45.9 KB)
The method is insertAttribute . Some test has been created and runs Ok . But two of them have the R013 code .

From the log file I can see
Multiple versions of dependencies are in use org.springframework.boot: - 2.7.3 - 3.0.2
You want to fix this this issue early because having multiple versions for the same dependency will limit the unit test coverage.

Line 328 in your log file is the place where you can start looking for a solution to R013 but please not that the method insertAttribute() has got already 4 unit tests. This means that some of its functionality is tested. For the remaining two partial tests you need investigate the fields highlighted int he image below

You might think about your own solution or we can help you by using Diffblue rules Customizing test inputs | Diffblue Docs but we wouldn’t do it here as this forum is public. One more thing which is worth mentioning is that you can keep the partial tests in your test folder using the settings shown in the image below

Doing so will let you see what Diffblue Cover wrote and this may help you to manually complete the test.

Kind Regards,

Thank you . I will consider this options .