Class ChainedAssertionLosesContext

java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.ChainedAssertionLosesContext
All Implemented Interfaces:
BugChecker.MethodInvocationTreeMatcher, Suppressible, Serializable

public final class ChainedAssertionLosesContext extends BugChecker implements BugChecker.MethodInvocationTreeMatcher
Identifies calls to assertThat and similar methods inside the implementation of a Subject assertion method. These calls should instead use check(...).

// Before:
public void hasFoo() {
  assertThat(actual().foo()).isEqualTo(expected);
}

// After:
public void hasFoo() {
  check("foo()").that(actual().foo()).isEqualTo(expected);
}
See Also: