Interface AssertOnValueCloseness<T extends AssertOnValueCloseness<T>>

Type Parameters:
T - The "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
All Known Implementing Classes:
AbstractAssertWithValues, AbstractColumnValueAssert, AbstractRowValueAssert, AbstractValueAssert, ChangeColumnValueAssert, ChangeRowValueAssert, RequestColumnValueAssert, RequestRowValueAssert, TableColumnValueAssert, TableRowValueAssert

public interface AssertOnValueCloseness<T extends AssertOnValueCloseness<T>>
Defines the assertion methods on the closeness of a value.
Since:
1.1.0
Author:
Régis Pouiller
  • Method Details

    • isCloseTo

      T isCloseTo(Number expected, Number tolerance)
      Verifies that the value is close to a number.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to number 3 with a tolerance of 1 (that means that all the numbers between 2 and 4 included are close enough) :

       
       assertThat(table).row().value().isCloseTo(3, 1);
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to number 3 with a tolerance of 0.75 :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(3, 0.75);
       
       
      Parameters:
      expected - The expected number value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the number in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(DateValue expected, DateValue tolerance)
      Verifies that the value is close to a date.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a date value with a tolerance of 2 days :

       
       assertThat(table).row().value().isCloseTo(DateValue.of(2014, 7, 7), DateValue.of(0, 0, 2));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a date value with a tolerance of 2 days :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(DateValue.of(2014, 7, 7), DateValue.of(0, 0, 2));
       
       
      Parameters:
      expected - The expected date value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the date in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(DateValue expected, TimeValue tolerance)
      Verifies that the value is close to a date.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a date value with a tolerance of 1 hour :

       
       assertThat(table).row().value().isCloseTo(DateValue.of(2014, 7, 7), TimeValue.of(1, 0));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a date value with a tolerance of 1 hour :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(DateValue.of(2014, 7, 7), TimeValue.of(1, 0));
       
       
      Parameters:
      expected - The expected date value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the date in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(DateValue expected, DateTimeValue tolerance)
      Verifies that the value is close to a date.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a date value with a tolerance of 2 days and 1 hour :

       
       assertThat(table).row().value().isCloseTo(DateValue.of(2014, 7, 7),
                                                 DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a date value with a tolerance of 2 days and 1 hour :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(DateValue.of(2014, 7, 7),
                                                 DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
       
       
      Parameters:
      expected - The expected date value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the date in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(TimeValue expected, TimeValue tolerance)
      Verifies that the value is close to a time.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a time value with a tolerance of 1 hour :

       
       assertThat(table).row().value().isCloseTo(TimeValue.of(21, 29, 30), TimeValue.of(1, 0));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a time value with a tolerance of 1 hour :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(TimeValue.of(21, 29, 30), TimeValue.of(1, 0));
       
       
      Parameters:
      expected - The expected time value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the time in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(DateTimeValue expected, DateValue tolerance)
      Verifies that the value is close to a date/time.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a date/time value with a tolerance of 2 days :

       
       assertThat(table).row().value().isCloseTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
                                                 DateValue.of(0, 0, 2));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a date/time value with a tolerance of 2 days :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(
                                                 DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
                                                 DateValue.of(0, 0, 2));
       
       
      Parameters:
      expected - The expected date/time value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the date/time in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(DateTimeValue expected, TimeValue tolerance)
      Verifies that the value is close to a date/time.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a date/time value with a tolerance of 1 hour :

       
       assertThat(table).row().value().isCloseTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
                                                 TimeValue.of(1, 0));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a date/time value with a tolerance of 1 hour :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(
                                                 DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
                                                 TimeValue.of(1, 0));
       
       
      Parameters:
      expected - The expected date/time value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the date/time in parameter.
      See Also:
    • isCloseTo

      T isCloseTo(DateTimeValue expected, DateTimeValue tolerance)
      Verifies that the value is close to a date/time.

      Example where the assertion verifies that the value in the first Column of the first Row of the Table is close to a date/time value with a tolerance of 2 days and 1 hour :

       
       assertThat(table).row().value().isCloseTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
                                                 DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
       
       

      Example where the assertion verifies that the value in the first Column of the Row at end point of the first Change is close to a date/time value with a tolerance of 2 days and 1 hour :

       
       assertThat(changes).change().rowAtEndPoint().value().isCloseTo(
                                                 DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
                                                 DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
       
       
      Parameters:
      expected - The expected date/time value.
      tolerance - The tolerance of the closeness.
      Returns:
      this assertion object.
      Throws:
      AssertionError - If the value is not close to the date/time in parameter.
      See Also: