title: Unit testing using mockito
body: <p>I want to write unit test case for bestElement() method using mockito. ClassA and ClassB are in same package. I want to test when the array list is empty and when the array list is not empty. I am new in unit testing. Please guide me how to write unit test for this method for both the cases. Also mention if any other information is required. THANKS!</p>
  
  <pre><code>public class ClassA{
  
      private final ArrayList&lt;ClassB&gt; array = new ArrayList&lt;&gt;();
  
      public ClassB bestElement() {
  
      if (array.isEmpty()) {
          return null;
      }
  
      ClassB first = array.get(0);
      array.remove(0);
      return first;
  }
  </code></pre>