title: Junit testing on an ArrayList
body: <p>Suppose that I have the below class, a simple class just to add three Strings into a String ArrayList named ar.</p>
  
  <pre><code>public class Testcases {
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
      // TODO code application logic here
  
  }
  
  public ArrayList&lt;String&gt; myArray()    {
      ArrayList&lt;String&gt; ar = new ArrayList&lt;String&gt;();
      ar.add("Customer1");
      ar.add("Customer2");
      ar.add("Customer3");
      return(ar);
   }
  }
  </code></pre>
  
  <p>How could I use Junit testing to make sure that the Strings actually went into ArrayList?</p>
  
  <p><strong>Update</strong></p>
  
  <p>My TestcasesTest file - where the testing is done, looks as follows:</p>
  
  <pre><code>@Test
  public void testMain() {
      System.out.println("main");
      String[] args = null;
      Testcases.main(args);
      // TODO review the generated test code and remove the default call to fail.
      // fail("the test case is a resul in the prototype");
  }
  
  /**
   * Test of add method, of class Testcases.
   */
  @Test
  public void testMyArray() {
      assertEquals(Arrays.asList("Customer1", "Customer2", "Customer3"), myArray());
  }
  
  }
  </code></pre>