What's new in Diffblue Cover version 2020.11.04?

Assertions on methods that return Maps, Lists & Sets

assertEquals("Dr Jane Doe", list.get(1));
assertEquals(7, readFromDBResult.getAccounts().size());

Diffblue now generates assertions for methods that return Maps, Lists & Sets - we now generate assertions on the content of the list and parameters such as size.

Support for Spring @Profile

@Profile("dev")
public String initCreationForm(Map<String, Object> model) {
    ...

Your Spring project may use  different configuration profiles, for example, dev, test, and prod, which distinguish the environment your application is running in. Diffblue Cover now allows you to set the Spring @Profile to use in the plugin settings page. Typically, for use with Diffblue Cover you’ll need to use a profile that allows you to run your tests without accessing systems that are only available in the production environment.

But how do I maintain all of these tests?

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

Cover gives you tests when we can’t find assertions

@Test public void testSetVisitsInternal() {
    // TODO: This test is incomplete - see https://diff.blue/R004
    //  Reason: No meaningful assertions found.
    //  To help Diffblue Cover to find assertions, please add getters to the
    //  class under test that return fields written by the method under test.
    Pet pet = new Pet();
    pet.setVisitsInternal(this.collection);
}

Sometimes Diffblue Cover can arrange a test and create the objects but can’t find any valid assertions. From this release we will give you these tests and a nice reminder saving you a bunch of time 👍

View full release notes

Release date:

Nov 24, 2020

Twitter Facebook LinkedIn Medium
Sign up to our newsletter