Details

Recommendation type: Assertions for inaccessible fields

Configurable: Yes

Filter category: Assertions

Description

This recommendation is displayed when your running your code using the Track option. If UTA detects that inaccessible fields have been changed during execution, it displays relevant information and  generates assertion templates that require manual modifications of code. See Tracking Object Changes and Creating Assertions for details.

Example

UTA will display this recommendation if the following code is executed with the Track option:

public class Example {
    private boolean flag = false;

    void setFlag(boolean flag) {
        this.flag = flag;
    }
}

@Test
public void testSetFlag()
{
    Example example = new Example();
    boolean flag = true;
    example.setFlag(flag);
}

Click the Make assertion templates action link to generate the assertion template:

// Then - assertion templates for this instance of ExampleTest.Example
boolean example_flag = false; // UTA: default value
assertTrue(example_flag);
  • No labels