title: Junit test on an ArrayList of ArrayLists
body: <p>I am a beginner in Java I'm trying to learn by practice and I found this exercise that has as a purpose to partition a list to sublists of n size 
  the method partition take in argument (ArrayList, size)</p>
  
  <p>For example:<br>
  <code>partition([1,2,3,4,],2)</code> will return <code>([1,2],[3,4])</code><br>
  <code>partition([1,2,3,4,],3)</code> will return <code>([1,2,3],[4])</code></p>
  
  <pre><code>package partition;
  import java.util.ArrayList;
  import java.util.List;
  
  public class Partition {
  
  
      public ArrayList&lt;ArrayList&gt; partition(List&lt;Integer&gt; li, int n) {
          ArrayList&lt;ArrayList&gt; al = new ArrayList();
          int start = 0;
          int i=n;
          for(; i&lt;li.size(); i+=n){
              List&lt;Integer&gt; lis = li.subList(start, i);
              ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();
              list.addAll(lis);
              al.add(list);
              start = i;
          }
  
          if(i &gt;= li.size()){
              List&lt;Integer&gt; lis = li.subList(start, li.size());
              ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();
              list.addAll(lis);
              al.add(list);
          }
          return al;
      }
  }
  </code></pre>
  
  <p>I want to write a Junit test to test all cases. I'm trying to read documentation on how to use Junit but I'm finding some difficulties to do it for this case.
  Can someone help me please by giving some indication or an example which looks like this one so I can test all the cases.</p>