2 Minutes To Code (β Version)

Easymock - 2 minute tutorial

How to creating mock of a class

Besides mocking interfaces, Easymock also let's you mock concrete classes using method createMock(...) of class org.easymock.EasyMock.

However for this, you need objenesis, cglib & asm api as mentioned in the requirements checklist page.
package com.techfundaes.easymockBag;

import java.util.ArrayList;

import static org.easymock.EasyMock.*;

public class MockingClass
{
	public static void main(String[] args)
	{
		ArrayList list = createMock(ArrayList.class);
		
		expect(list.get(0)).andReturn("jwkus");
		
		replay(list);
		
		System.out.println(list.get(0));
	}
}