Skip to content

Instantly share code, notes, and snippets.

@jjlumagbas
Last active September 23, 2016 01:47
Show Gist options
  • Save jjlumagbas/7715b38d0779dcb2ee6e40cab8290b5e to your computer and use it in GitHub Desktop.
Save jjlumagbas/7715b38d0779dcb2ee6e40cab8290b5e to your computer and use it in GitHub Desktop.
import junit.framework.TestCase;
import java.util.*;
public class ArrayListTest extends TestCase {
private final int INITIAL_CAPACITY = 5;
public void testAddOne() {
List<String> l = new ArrayList<String>();
l.add("Deodorant");
assertEquals("added Deodorant and got back Deodorant", "Deodorant", l.get(0));
}
public void testAddMultiple() {
// add 3 items
fail(); // remove this line
}
public void testAddMiddle() {
// Add 2 then add 1 at the start of the list
fail(); // remove this line
}
public void testAddExtend() {
// Add 8 items
List<String> l = new ArrayList<String>(INITIAL_CAPACITY);
fail(); // remove this line
}
public void testRemoveEnd() {
// add two then remove the last one
fail(); // remove this line
}
public void testRemoveStart() {
// Remove start: add two then remove the first one
fail(); // remove this line
}
public void testRemoveString() {
// Remove string: add "Deodorant", "Soap", and remove "Deodorant", use remove(Object o)
fail(); // remove this line
}
public void testReplaceFirst() {
// Replace first: add 2 then replace the first, use set(int index, E element)
fail(); // remove this line
}
public void testGetSecond() {
// Get 2nd: add 3 then get second
fail(); // remove this line
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment