What's New > Version 2021.05.02

Increased test coverage

Release date: May 24, 2021

Increased test coverage

Cover now writes tests for explicitly thrown exceptions in methods even if other tests could not be generated for the method. This ensures that you have tests for exception cases, which is highly valuable when catching regressions.

@Pattern is now supported in the definition of a Spring path variable (@PathVariable). 


In REST controller methods, Diffblue Cover now takes the regexp value in @Pattern annotations into account to find suitable path variable instantiations. This is in addition to using any regexp value present in the URI path.

An example is below:

  @GetMapping("/customers/{customerId}")
  public Customer getCustomer(
    @PathVariable
    @Pattern(
      regexp = "^[0-9]+$",
      message = "Customer id should be a positive integer")
    String customerId) {
            ...
  }

Diffblue Cover Community Edition is available for use with commercial code

Community Edition allows you to write tests for both open source and commercial code. This means you can now use Diffblue Cover Community Edition at work completely for free. Visit our documentation to learn more about how you can use Diffblue Cover at work, and also see our End-User License Agreement

Feedback

If you have feedback, questions or requests regarding the Diffblue Cover IntelliJ Plugin, please contact us on the Community Forum. We would love to hear about what is important to you and what you would like to see in upcoming releases.

How do I automatically maintain all of these tests?

Use Diffblue Cover on any CI platform to automatically update your unit tests and catch regressions for every commit - watch this video to learn more.


Full Release Notes

Enhancements

  • CLI: Cover no longer runs Spring Boot applications before creating tests unless --spring-integration-tests is used. [Ref: TG-13891]

  • IntelliJ Plugin: Cover now shows a flask icon with a strikethrough next to private methods, indicating that they are not directly testable. [Ref: TG-14592]

  • Cover now writes tests for explicitly thrown exceptions. [Ref: TG-14396]

  • Cover no longer discards tests if the Mockito execution leaves a mockitoboot.jar in the temporary folder. [Ref: TG-14389]

  • Cover no longer attempts to write tests for methods with an empty body. [Ref: TG-13563]

Resolved Issues

  • CLI: Resolved an issue which, when --keep-tests-without-assertions is used, may result in Cover discarding tests without assertions. [Ref: TG-14401]

  • CLI: Resolved an issue where, in some circumstances, the progress bar displayed during test creation did not accurately reflect progress. [Ref: TG-14309]

  • CLI: Resolved an issue which, in some circumstances, would cause Mockito verify() calls to be written in a non-deterministic order. [Ref: TG-14277]

  • IntelliJ Plugin: Resolved an issue which caused Cover’s ‘Write Test’ flask icons to appear next to methods and classes in decompiled files. [Ref: TG-14442]

  • IntelliJ Plugin: Resolved an issue which, in some circumstances, would result in Cover not reindexing Gradle projects after compilation. [Ref: TG-14385]

Known Issues

  • CLI: Windows: creating config.json by outputting --example-config as file causes exceptions. [Ref: TG-11198]

  • CLI: All tests may be discarded in test validation when using --config. [Ref: TG-11475]

  • CLI: dcover clean --working-directory throws an error if --test-output-dir is not provided. [Ref: TG-11665]

  • CLI: dcover clean --failing fails when used with a Gradle project. [Ref: TG-11707]

  • IntelliJ Plugin: Diffblue Cover was unable to create an index error may appear if switching project happens before Cover has finished indexing. [Ref: TG-13772]