Esempio n. 1
0
  /** Test the addAll methods add the correct values. */
  @Test
  public void testAddAll() {
    LinkedList<String> l = new LinkedList<String>();
    l.add(ELEMENT3);
    l.add(ELEMENT2);
    l.add(ELEMENT1);

    _dbVector.addAll(l);
    assertTrue("Check the number of values", _dbVector.size() == 6);
    assertEquals("Check element 1", ELEMENT1, _dbVector.get(0));
    assertEquals("Check element 2", ELEMENT2, _dbVector.get(1));
    assertEquals("Check element 3", ELEMENT3, _dbVector.get(2));
    assertEquals("Check element 3", ELEMENT3, _dbVector.get(3));
    assertEquals("Check element 2", ELEMENT2, _dbVector.get(4));
    assertEquals("Check element 1", ELEMENT1, _dbVector.get(5));

    _dbVector.addAll(1, l);
    assertTrue("Check the number of values", _dbVector.size() == 9);
    assertEquals("Check element 1", ELEMENT1, _dbVector.get(0));
    assertEquals("Check element 3", ELEMENT3, _dbVector.get(1));
    assertEquals("Check element 2", ELEMENT2, _dbVector.get(2));
    assertEquals("Check element 1", ELEMENT1, _dbVector.get(3));
    assertEquals("Check element 2", ELEMENT2, _dbVector.get(4));
    assertEquals("Check element 3", ELEMENT3, _dbVector.get(5));
    assertEquals("Check element 3", ELEMENT3, _dbVector.get(6));
    assertEquals("Check element 2", ELEMENT2, _dbVector.get(7));
    assertEquals("Check element 1", ELEMENT1, _dbVector.get(8));
  }
Esempio n. 2
0
 /** Test the remove method removes the correct values. */
 @Test
 public void testRemove2() {
   _dbVector.remove(ELEMENT2);
   assertEquals("Check element 1", ELEMENT1, _dbVector.get(0));
   assertEquals("Check element 3", ELEMENT3, _dbVector.get(1));
   assertTrue("Check the number of values", _dbVector.size() == 2);
 }
Esempio n. 3
0
 /** Test the set method sets the correct values. */
 @Test
 public void testSet() {
   _dbVector.set(0, ELEMENT2);
   _dbVector.set(1, ELEMENT1);
   assertTrue("Check the number of values", _dbVector.size() == 3);
   assertEquals("Check element 1", ELEMENT1, _dbVector.get(1));
   assertEquals("Check element 2", ELEMENT2, _dbVector.get(0));
   assertEquals("Check element 3", ELEMENT3, _dbVector.get(2));
 }
Esempio n. 4
0
 /** Test the clear() and size() methods. */
 @Test
 public void testClearAndSize() {
   assertEquals("Check size 1", 3, _dbVector.size());
   _dbVector.clear();
   assertEquals("Check size 2", 0, _dbVector.size());
 }