Exemple #1
0
 @Test
 public void testsGetRestArray() {
   FunctionalList testList = new FunctionalArrayList();
   assertEquals("get Rest on empty", 0, testList.rest().size());
   testList.add("zero");
   assertEquals("get Rest on list of one", 0, testList.rest().size());
   testList.add("one");
   testList.add("two");
   testList.add("three");
   assertEquals("get Rest on list of 4", 3, testList.rest().size());
   assertEquals("test specific elements", "one", testList.rest().get(0).getReturnValue());
   assertEquals("test specific elements", "two", testList.rest().get(1).getReturnValue());
   assertEquals("test specific elements", "three", testList.rest().get(2).getReturnValue());
 }
Exemple #2
0
 @Test
 public void testsGetHeadLinked() {
   FunctionalList testList = new FunctionalLinkedList();
   assertEquals("get Head on empty", ErrorMessage.EMPTY_STRUCTURE, testList.head().getError());
   testList.add("zero");
   testList.add("one");
   testList.add("two");
   assertEquals(
       "get Head when not empty, no error", ErrorMessage.NO_ERROR, testList.head().getError());
   assertEquals("get Head when not empty, correct item", "zero", testList.head().getReturnValue());
 }