All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.is_assertion_template.txt Maven / Gradle / Ivy

There is a newer version: 1.1
Show newest version

  /**
   * Verifies that the actual ${class_to_assert} is ${property}.
   * @return this assertion object.
   * @throws AssertionError - if the actual ${class_to_assert} is not ${property}.
   */
  public ${class_to_assert}Assert is${Property}() {
    // check that actual ${class_to_assert} we want to make assertions on is not null.
    isNotNull();

    // we overrides the default error message with a more explicit one
    String errorMessage = format("Expected actual ${class_to_assert} to be ${property} but was not.", actual);
    
    // check
    if (!actual.is${Property}()) throw new AssertionError(errorMessage);

    // return the current assertion for method chaining
    return this;
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy