Exemplo n.º 1
0
 /** clear removes all elements */
 public void testDescendingClear() {
   NavigableSet q = populatedSet(SIZE);
   q.clear();
   assertTrue(q.isEmpty());
   assertEquals(0, q.size());
   assertTrue(q.add(new Integer(1)));
   assertFalse(q.isEmpty());
   q.clear();
   assertTrue(q.isEmpty());
 }
Exemplo n.º 2
0
  @Test
  public void WriteDBInt_lastKey_set_middle() {
    int numberOfRecords = 1000;

    /* Creates connections to MapDB */
    DB db1 = DBMaker.memoryDB().transactionDisable().make();

    /* Creates maps */
    NavigableSet<Integer> map1 = db1.treeSet("column1");

    /* Inserts initial values in maps */
    for (int i = 0; i < numberOfRecords; i++) {
      map1.add(i);
    }

    assertEquals((Object) (numberOfRecords - 1), map1.last());

    map1.clear();

    /* Inserts some values in maps */
    for (int i = 100; i < 110; i++) {
      map1.add(i);
    }

    assertEquals(10, map1.size());
    assertFalse(map1.isEmpty());
    assertEquals((Object) 109, map1.last());
    assertEquals((Object) 100, map1.first());
  }