title: How to mock big ArrayList by Mockito?
body: <p>I am going to make method which will analyze big ArrayList. and I want to write test method in JUnit. The size of ArrayList could reach up to couple of millions. I think that it is not good idea to connect to the database and get datas from there for analyzing because a test is not a unit test if it talks to the database. So how should I act correctly in this situation? Or how big datas are analyzed by unit tests generally?</p>
  
  <p>Example:</p>
  
  <pre><code>public void analyze(List&lt;Double&gt; list) {
  
      double n1, n2, n3;
  
      for (int i = 3; i &lt; list.size(); i += 3) {
  
          n1 = list.get(i - 3);
          n2 = list.get(i - 2);
          n3 = list.get(i - 1);
  
          if (/* Some condition here using n1, n2, n3*/) {
              list.remove(i);
          }
      }
  }
  
  @Test
  public void analyzeTest() {
  
      List&lt;Double&gt; list = new ArrayList&lt;Double&gt;();
  
      // To add 1M data here.
  
      analyze(list);
  
      assertEquals(list, expected);
  
  }
  </code></pre>