title: Java - Need advice on how to unit test this class
body: <p>I'm not very experienced when it comes to constructing unit tests or test cases, and right now I'm in need of some advice. I have this class that I'm planning to make, but I'm not sure what the best way of unit testing it would be. I have not written the class yet but it will look something like this:</p>
  
  <pre><code>public class ClassName {
  
      private ArrayList&lt;Order&gt; sortedOrderList1 = new ArrayList&lt;&gt;();
      private ArrayList&lt;Order&gt; sortedOrderList2 = new ArrayList&lt;&gt;();
  
      public void method1(Order order) {
        //Modifies Order objects inside sortedOrderList1 or sortedOrderList2.
      }
  
      public method2(Order order) {
        //Modifies Order objects inside sortedOrderList1 or sortedOrderList1.
      }
  }
  </code></pre>
  
  <p>The <code>Order</code> objects inside the lists have <code>price</code> and <code>quantity</code>. The methods will go into the lists and subtract from <code>quantity</code> for some of the Order objects at the end of the lists, and also remove objects whose <code>quantity</code> has reached 0.</p>
  
  <p>Now the problem is that I don't know what the best way of testing these methods would be. In my JUnit class I won't be able to access the <code>private</code> lists, and the methods themselves have no return value for me to check. What would be the best practice way of testing methods like these?</p>