title: Create a list with EasyMock
body: <p>I am currently learning EasyMock and I have read some tutorials about it. Based on the knowledge, I have acquired, I try to create a mock list but it gives me AssertionError, whose reason I could not understand.</p>
  
  <p>Basically, I want to have a list, whose first element is 1133L and second element is 1139L and the size of it is naturally 2.</p>
  
  <p>My method</p>
  
  <pre><code>@Test
  public void testCreateIdealConf()
  {
  
  List&lt; Long &gt; idList = createMock( List.class );
  
  expect( idList.get( 0 ) ).andReturn( 1133L );
  expect( idList.get( 1 ) ).andReturn( 1139L );
  expect( idList.size() ).andReturn( 2 );
  
  replay( idList );
  
  for( int i = 0; i &lt; idList.size(); i++ )
  {
    System.out.println( "Elements: " + idList.get( i ) );
  }
  }
  </code></pre>
  
  <p>When I run this test method, it gives the following error</p>
  
  <pre><code>java.lang.AssertionError: 
  Unexpected method call List.size():
  List.get(1): expected: 1, actual: 0
  List.size(): expected: 1, actual: 2
  at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:44)
  at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:94)
  at com.sun.proxy.$Proxy7.size(Unknown Source)
  at de.psi.passage3.auslieferung.allg.gui.status.CasBarUserConfigurationArrangementsTest.testCreateIdealConf(CasBarUserConfigurationArrangementsTest.java:113)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at 
  the rest of the failure trace is omitted.
  </code></pre>
  
  <p>Where do I make a mistake or do I except something wrong from a mock object/list?</p>