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");
}
| Modifier and Type | Method and Description |
|---|---|
| public A | Returns: the assert object for use in conjunction withAssertions#assertThat(AssertProvider)Returns the associated |
| assertThat | back to summary |
|---|---|
| public A assertThat() Returns the associated
| |