示例#1
0
 @Test
 public void testGetSize() throws Exception {
   assertEquals(0, stack.getSize());
   for (int i = 0; i < inputArray.length; i++) {
     stack.push(inputArray[i]);
     assertEquals(i + 1, stack.getSize());
   }
 }
示例#2
0
 @Test
 public void testPushAll() throws Exception {
   for (String inputItem : inputArray) {
     inputList.add(inputItem);
   }
   stack.pushAll(inputList);
   assertEquals(inputArray.length, stack.getSize());
   assertTrue(stack.isFull());
   for (int i = inputArray.length - 1; i >= 0; i--) {
     assertEquals(inputArray[i], stack.pop());
   }
   assertEquals(0, stack.getSize());
   assertTrue(stack.isEmpty());
 }