Knowledge Base > IntelliJ Plugin > About assertions

About assertions

Assertions need to be meaningful to be of use. To generate a meaningful assertion, i.e. one that is specific and related to the inputs in the Arrange section, please follow the example below.

If you have a class like this:

public class Foo {

  int bar;
  int baz;

  public void updateBar() {
    bar += 1;
  }

}

and you want to test the method updateBar, then an assertion on the value of bar would be meaningful because it checks the effect of the method.

In the example above, an assertion on the value of baz would not be meaningful, because the value of the field is not changed by the method at all.