Tests for methods using ZonedDateTime

Diffblue Cover is now able to use more aggressive mocking techniques to mitigate issues caused by unsatisfied external dependencies. Such external dependencies can include specific environments, files or network services. As of this release, Cover utilizes better algorithms and techniques to handle such cases more effectively by avoiding execution of the problematic code.

Given the following code:

  public class Resource {
    public long getSize() {
    // !!! Code failure simulation !!!
      throw new NullPointerException();
  public class ServiceController {
    public ServiceController() {
    public Resource getResource() {
      return new Resource();
  public class ServiceBuilder {
    public ServiceController build() {
      return new ServiceController();
  public class ClassUnderTest {
      public ClassUnderTest( ServiceController controller ) {
      //Calling problematic code

Cover is now able to write a valid test:

  class ClassUnderTestDiffblueTest {
      * Method under test: {@link ClassUnderTest#ClassUnderTest(ServiceController)}
      void testConstructor() {
          // Arrange
          Resource resource = mock(Resource.class);
          ServiceController controller = mock(ServiceController.class);
          // Act
          new ClassUnderTest(controller);
          // Assert


  • Cover is now able to construct mock objects with deeper levels of nesting. Previously, where Cover couldn't have written tests because it was unable to mock such objects, R013 (No inputs found that don't throw a trivial exception) would've been reported. [Ref: TG-19023]

  • Cover now ensures that the Mockito version in use is not too high for the selected Java version. This is shown in the Project Environment Health Check panel in the IntelliJ plugin and is provided as a warning in the CLI. [Ref: TG-19020]

  • CLI: Cover now enforces a minimum Maven Surefire Plugin version of 2.19 when using JUnit 4 and Cover CLI's --coverage-reports option to upload reports bundles to Cover Reports. [Ref: TG-18783]

  • CLI: Cover's preflight checks now ensure that JaCoCo has been configured correctly so that the --coverage-reports option can be used reliably. [Ref: TG-18660]

  • Cover is now better at detecting that a class is a Spring bean and should be tested using Spring dependency injection. [Ref: TG-19162]

  • Reports: Improved 'sizing option buttons' experience on the Project Map view. [Ref: TG-19177]

  • Reports: Cover now shows a filterable list of projects on the homepage, replacing the 'getting started' view, once a coverage reports bundle has been uploaded. This ensures accurate coverage data is reported to Cover Reports. [Ref: TG-19028]

  • Refactor: Cover now places getters with its corresponding setter, other getters or constructors instead of at the end of the file. See the Cover Refactor documentation for more details. [Ref: TG-19119]

Resolved Issues

  • Resolved an issue which, in some circumstances, caused Cover to incorrectly mock the method under test. [Ref: TG-18971]

  • CLI: Resolved an issue which caused Cover to incorrectly report error detected while trying to execute tests despite the --skip-test-validation option being passed. Cover now reports disabled, at user's request. [Ref: TG-18421]

Known Issues

  • Cover may produce tests for JUnit 4.10 and lower that do not compile due to the use of assertNotEquals. [Ref: TG-17605]

  • IntelliJ Plugin: Upgrading to IntelliJ IDEA 2022.3 may, in some circumstances, cause existing run configurations to no longer produce tests. Removing any run configurations for that entity and writing tests again will recreate a working run configuration. [Ref: TG-18282]

Last updated