Links

Packages, classes, and methods

By default, the dcover create, dcover validate, and dcover clean commands automatically run across the entire project. If required, you can specify what packages, classes, or methods you want to restrict these operations to, on the command line (for example, dcover create io.corebanking.Account or dcover validate io.corebanking.Account).

Package example

dcover create com.a.. This will produce tests for all accessible methods within package com.a. and any sub-packages. For example, tests will be written for class com.a.B and com.a.b.C but not for com.x.Y. Note that com.a (not com.a.) will allow tests to be written for class com.apple, com.apricot etc.

Class example

Given two classes io.diffblue.corebanking.account.Account and io.diffblue.corebanking.account.AccountException:
  • Using dcover create io.diffblue.corebanking.account.Account will create tests for both classes.
  • Using dcover create io.diffblue.corebanking.account.Account. (note the trailing .) will create tests for the Account class only.

Method example

dcover create io.diffblue.corebanking.account.Account.addToBalance: (note the trailing :)
will create tests for all methods named addToBalance, e.g. addToBalance(int value) and addToBalance(double value), but not addToBalanceDeferred(int value). In order to write tests for addToBalance(double value) only, but not for addToBalance(int value), you also have to specify the method descriptor:
dcover create 'io.diffblue.corebanking.account.Account.addToBalance:(D)V'.
The method descriptor is a list of type descriptors in a single string, that describe the parameter types and the return type of a method. As in the example above, the type descriptor (D for double) is enclosed within parentheses, followed by the type descriptor of the return type OR a V if the method returns void. For more information on type descriptors and method descriptors, please see sections 2.1.3 and 2.1.4 of the ASM 4.0 A Java bytecode engineering library.
Note that:
  • The descriptor is separated from the method name by :.
  • You can also specify a list of prefixes to ignore, using the --exclude option with dcover create.