What's New > Version 2020.07.b

Added mocking of classes

Release date: Jul 20, 2020

Cover now supports mocking of classes via the --mock option. A single class, or a series of strings which represent the prefixes of classes to be mocked can be specified. It also creates tests for exceptions, defined by a throw statement, if a non-exception test case is present for the method being tested. Support for JUnit 4.13 has been added.


Full Release Notes

Enhancements

  • CLI: Cover’s summary output has been updated with clearer reasoning for not creating tests. [Ref: TG-12258]

  • CLI: Cover now supports mocking of classes via the --mock option. A single class, or a series of strings which represent the prefixes of classes to be mocked can be specified. [Ref: TG-12217]

  • CLI: Cover now creates tests for exceptions, defined by a throw statement, if a non-exception test case is present for the method being tested. [Ref: TG-12150]

  • Cover now supports JUnit 4.13. [Ref: TG-12122]

Resolved Issues

  • IntelliJ Plugin: Resolved an issue where tests may not be created for boxed types in arrays. [Ref: TG-12305]

  • IntelliJ Plugin: Resolved an issue where the ‘Assertion Suggestions’ service may not be terminated when IntelliJ is closed. [Ref: TG-12276]

  • CLI: Resolved an issue where executing dcover clean --failing may result in unexpected test failures. [Ref: TG-12240]

  • IntelliJ Plugin: Fixed a cosmetic issue where Indexing {0} may be shown under the ‘Creating Diffblue Cover indexes’ background task. [Ref: TG-12227]

  • Resolved an issue where some tests created for a Spring method would fail ‘Test Validation’ with a Compilation error or Runtime error. [Ref: TG-11984]

  • IntelliJ Plugin: Resolved an issue where java.lang.Throwable: Showing dialogs from popup onChosen can result in focus issues. may be shown. [Ref: TG-11929]

  • CLI: Resolved an issue where Cover does not use JAVA_HOME when calling Maven, resulting in No compiler is provided in this environment errors. [Ref: TG-11844]

  • CLI: Resolved an issue where Cover will attempt ‘Test Validation’ in cases where no tests had been created. [Ref: TG-11564]

  • IntelliJ Plugin: Resolved an issue where some tests which can be created through the CLI are not created through the IntelliJ plugin. [Ref: TG-10108]

Known Issues

  • Wrong reason for not creating essential tests for methods in classes without accessible constructors. [Ref: TG-10794]

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

  • CLI: All tests may be discarded in test verification 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 fails to generate tests, reporting java.lang.OutOfMemoryError, when analysing projects which spawn a quantity of threads in excess of the operating system’s process thread limit. [Ref: TG-11680]

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

  • Tests are not generated for methods of Spring controllers that contain an autowired field. [Ref: TG-11835]

  • IntelliJ Plugin: Selecting ‘Write tests’ across multiple modules, in quick succession, can cause the plugin to crash with a NullPointerException. [Ref: TG-12022]

  • CLI: Test verification may fail on a Gradle project due to an incompatibility between Gradle and Cover. If you encounter this issue, run with --skip-test-verification. [Ref: TG-12045]

Dependencies for written tests

  • JUnit: 4.7-5.6