/** This method should fail because the value is no close to. */
  @Test
  @NeedReload
  public void should_fail_because_value_is_not_close_to() {
    Table table = new Table(source, "test");
    Changes changes = new Changes(table).setStartPointNow();
    update("update test set var14 = 1 where var1 = 1");
    changes.setEndPointNow();

    try {
      assertThat(changes)
          .change()
          .column("var10")
          .valueAtEndPoint()
          .isCloseTo(
              DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 31)),
              TimeValue.of(0, 0, 0, 1));
      fail("An exception must be raised");
    } catch (AssertionError e) {
      Assertions.assertThat(e.getMessage())
          .isEqualTo(
              String.format(
                  "[Value at end point of Column at index 9 (column name : VAR10) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n"
                      + "Expecting:%n"
                      + "  <2014-05-24T09:46:30.000000000>%n"
                      + "to be close to: %n"
                      + "  <2014-05-24T09:46:31.000000000> %n"
                      + " with tolerance <00:00:00.000000001>"));
    }
    try {
      assertThat(table)
          .column("var10")
          .value()
          .isCloseTo(
              DateTimeValue.of(DateValue.of(2014, 5, 24), TimeValue.of(9, 46, 31)),
              TimeValue.of(0, 0, 0, 100));
      fail("An exception must be raised");
    } catch (AssertionError e) {
      Assertions.assertThat(e.getMessage())
          .isEqualTo(
              String.format(
                  "[Value at index 0 of Column at index 9 (column name : VAR10) of TEST table] %n"
                      + "Expecting:%n"
                      + "  <2014-05-24T09:46:30.000000000>%n"
                      + "to be close to: %n"
                      + "  <2014-05-24T09:46:31.000000000> %n"
                      + " with tolerance <00:00:00.000000100>"));
    }
  }
 /** This method should fail because the number of modified columns is greater or equal. */
 @Test
 public void should_fail_because_number_of_modified_columns_is_greater_or_equal()
     throws Exception {
   WritableAssertionInfo info = new WritableAssertionInfo();
   info.description("description");
   Table table = new Table();
   TableAssert tableAssert = assertThat(table);
   Row rowAtStartPoint =
       getRow(
           null,
           Arrays.asList("ID", "NAME", "FIRSTNAME", "BIRTH"),
           Arrays.asList(
               getValue(null, 1),
               getValue(null, "Weaver"),
               getValue(null, "Sigourney"),
               getValue(null, Date.valueOf("1949-10-08"))));
   Row rowAtEndPoint =
       getRow(
           null,
           Arrays.asList("ID", "NAME", "FIRSTNAME", "BIRTH"),
           Arrays.asList(
               getValue(null, 1),
               getValue(null, "Weaverr"),
               getValue(null, "Sigourneyy"),
               getValue(null, Date.valueOf("1949-10-08"))));
   Change change =
       getChange(DataType.TABLE, "test", ChangeType.MODIFICATION, rowAtStartPoint, rowAtEndPoint);
   try {
     AssertionsOnModifiedColumns.hasNumberOfModifiedColumnsLessThan(tableAssert, info, change, 1);
     fail("An exception must be raised");
   } catch (AssertionError e) {
     Assertions.assertThat(e.getMessage())
         .isEqualTo(
             String.format(
                 "[description] %n"
                     + "Expecting :%n"
                     + "  number of modifications is less than 1%n"
                     + "but was:%n"
                     + "  2"));
   }
 }