Exemplo n.º 1
0
  private void assertHandlerComparison(Comparable4 handler, Object smaller, Object greater) {
    PreparedComparison comparable = handler.prepareComparison(context(), smaller);
    Assert.isNotNull(comparable);
    Assert.areEqual(0, comparable.compareTo(smaller));
    Assert.isSmaller(0, comparable.compareTo(greater));
    Assert.isGreater(0, comparable.compareTo(null));

    comparable = handler.prepareComparison(context(), greater);
    Assert.isNotNull(comparable);
    Assert.areEqual(0, comparable.compareTo(greater));
    Assert.isGreater(0, comparable.compareTo(smaller));
    Assert.isGreater(0, comparable.compareTo(null));

    comparable = handler.prepareComparison(context(), null);
    Assert.isNotNull(comparable);
    Assert.areEqual(0, comparable.compareTo(null));
    Assert.isSmaller(0, comparable.compareTo(smaller));
  }
  private void assertFileSizeConstant() throws Exception {

    long beforeUpdate = dbSize();

    for (int j = 0; j < 10; j++) {

      defragment();

      for (int i = 0; i < 15; ++i) {
        updateItem();
      }
      defragment();
      long afterUpdate = dbSize();

      /*
       * FIXME: the database file size is uncertain?
       * We met similar problem before.
       */
      Assert.isSmaller(30, afterUpdate - beforeUpdate);
    }
  }