How many methods are checked in an object?

hi there

i have a lengthy class (ca 60 members) which is filled from a ResultSet.
Diffblue manages to generate a test which mocks the resultSet with mostly ‘generic’ data-providers:

    ResultSet rs = mock(ResultSet.class);
    when(rs.getDouble(Mockito.<String>any())).thenReturn(10.0d);
    when(rs.getFloat(Mockito.<String>any())).thenReturn(10.0f);
    when(rs.getInt(Mockito.<String>any())).thenReturn(1);
    when(rs.getString(Mockito.<String>any())).thenReturn(null);

after that, it calls many methods on the object and checks, if the returned value matches the mocked value - which they do.

However, not all methods are called to retrieve and check the value. Is there a limit of called methods? Where is the cut-off? Are they ordered lexically by name and the first 50 getters are called? what is going there? can i influence it?

greetings
dvh

Hi @dvholten,

This is interesting, to understand the issue better we need a bit more information.
Is it possible that all 60 members of the lengthy class rely on the same four methods mocked from ResultSet ?
A log file should tell us this - are you please able to upload the support log file relevant to this test.
For reference, to find the log file use the following documentation links; for the CLI, for the IntelliJ plugin.

Kind regards,

Jane @ Diffblue

i can send you the relevant files - but not to the forum.
whats your email or upload adress?

No problem - please send them to support@diffblue.com, we can help you from there.

Thank you,
Jane @ Diffblue

one more thing - as you can see in the LoadDataLineTest - class in methods testConstructor1() and testConstructor2() the methods called on the test-object seem to be in reverse lexical order: first getSonderText() … and getAddiIstVolume() at the end.

you may add this to the ‘nice-to-have’ - list: make the called methods in forward lexical order or in sourceCode order.

Thank you for the feedback - to give you more context, there isn’t currently a specific any consideration given to the order of the methods in the class under test. Assuming you ask Cover to write tests for the whole class; we will start analysing the methods in the order they appear in the source code (constructor first). Then when a test is complete it is appended to the test class file.

This is an area we are actively working on, so we appreciate this feedback.

Best regards,
Jane @ Diffblue

To conclude this thread following investigations off the forum with the log file:

There’s not a specific limit of called methods for Cover when analysing. Where there weren’t assertions for some called methods; Cover was just unable to find a reasonable assertion.
When this happens Cover will produce an output code in the log file, these give the user more information about why/where Cover had issues, and tips on how to proceed.