= Mockito = Unit tests mocks framework. == Example == {{{#!highlight java import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import org.junit.Assert; import org.junit.Test; import org.springframework.mock.env.MockEnvironment; public class TestX{ @Test public void testXyz() { MockEnvironment env = new MockEnvironment(); env.setProperty("intx", "1"); env.setProperty("intz", "10"); String rsp1="rsp1"; ClassX cx = mock(ClassX.class); when(cx.getURL(anyObject(), anyObject(), eq("aaaa"))).thenReturn(rsp1); doCallRealMethod().when(cx).initialize(any(), any()); doCallRealMethod().when(cx).doStuff(any(), any()); cx.initialize(null, env); List responsex = cx.doStuff(null, "kkll")); Assert.assertEquals(123, responsex.size()); } } }}}