How to test a new feature
A tutorial demonstrating using Diffblue Cover Plugin for IntelliJ to create tests for a new feature.
class OwnerController {
…
/**
* Counts the number of dogs belonging to the given owner.
* @param owner The owner
* @return The number of pets of type "Dog" belonging to the given owner
*/
public long countDogs(Owner owner) {
return owner.getPets().stream()
.filter(pet -> pet.getName().equals("Dog"))
.collect(Collectors.counting());
}
}
Last updated
Was this helpful?

