Advertisement
JeffGrigg

ListOfStringTest

Nov 26th, 2018
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.79 KB | None | 0 0
  1. import org.junit.Test;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import static org.junit.Assert.*;
  7.  
  8. public class ListOfStringTest {
  9.  
  10.     // This is the Code Under Test:
  11.     public static List<String> createListOfStringValues() {
  12.         return new ArrayList<String>();
  13.     }
  14.  
  15.     @Test
  16.     public void testSomeBasics() {
  17.         final List<String> listBeingTested = createListOfStringValues();
  18.         assertEquals("The List should start out empty;", 0, listBeingTested.size());
  19.         listBeingTested.add("one");
  20.         assertEquals("After one 'add';", 1, listBeingTested.size());
  21.         assertEquals("one", listBeingTested.get(0));
  22.         assertEquals("one", listBeingTested.remove(0));
  23.         assertEquals("Empty after 'remove';", 0, listBeingTested.size());
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement