easymock三步走

第一步:创建mock对象(createMock)
例: MyService myServiceMock = createMock(MyService.class);
第二步:记录预期行为(expect)
例:
SomeObject someobj = new SomeObject();
someobj.setBar(“bar”);
expect(myServiceMock.foo(isA(Some.class),anyInt())).andReturn(someobj );
第三步:回放(replay)
replay(myServiceMock);