Top Description Methods
org.assertj.core.api

public Interface AssertProvider<A>

Type Parameters
<A>
the type of the assert (not typed - to allow any kind of assert)

Provides a Assert for the current object.

Used to map an object to its Assert without having to create a new "Assertions" class.

Usage:
 public class Button implements AssertProvider<ButtonAssert> {
  public ButtonAssert assertThat() { 
    return new ButtonAssert(this); 
  } 
}

public class ButtonAssert extends Assert<ButtonAssert, Button> {
  public ButtonAssert containsText(String text) {
    ...
  }
}

void testMethod() {
  Button button = ...;

  // First option
  Assertions.assertThat(button).containsText("Test");

  // Second option
  button.assertThat().containsText("Test");
}
Author
Tobias Liefke

Method Summary

Modifier and TypeMethod and Description
public A

Returns:

the assert object for use in conjunction with Assertions#assertThat(AssertProvider)
assertThat
()

Returns the associated Assert for this object.

Method Detail

assertThatback to summary
public A assertThat()

Returns the associated Assert for this object.

Returns:A

the assert object for use in conjunction with Assertions#assertThat(AssertProvider)