Created
June 5, 2021 13:18
-
-
Save ahmetozlu/fc13d45a4d0a751c7d1767fff803202c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mytest; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
import java.util.*; | |
public class ArrayListTest { | |
private ArrayList<String> list = new ArrayList<String>(); | |
@Before | |
public void setUp() throws Exception { | |
} | |
@Test | |
public void testInsertion() { | |
list.add("Beijing"); | |
assertEquals("Beijing", list.get(0)); | |
list.add("Shanghai"); | |
list.add("Hongkong"); | |
assertEquals("Hongkong", list.get(list.size() – 1)); | |
} | |
@Test | |
public void testDeletion() { | |
list.clear(); | |
assertTrue(list.isEmpty()); | |
list.add("A"); | |
list.add("B"); | |
list.add("C"); | |
list.remove("B"); | |
assertEquals(2, list.size()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment