??????????????????α????????á?????????з??????????????????????????????????????????????
????EasyMock???????????????????????????????????????????????α????α??????????????????????е???в?????????????塣EasyMock????java.lang.reflect.Proxy????????????????????????????????????????????Proxy?????????????????????????????????α????
????Mocquer???????????????????????EasyMock?????????????????α????
????Mocquer????
????Mocquer????Dunamis????????????????????????????????????????????????????EasyMock???????????????淶????????????ò????????????
????MockControl??Mocquer????????????????????????α????????????????????塣?????????????????
????1??????????????????
????·public void replay();
????·public void verify();
????·public void reset();
????α??????????????????????????????????????????????????1?????α??????????????
????Figure 1. Mock object life cycle
??????????α?????????????????????????????????塣replay()?????α????????????????????????????α???????????y?????????????????????????verify()???ú?α????????????MockControl????α???????????????????????????????????????????MockControl????????????????????????????????????????replay()????????????????????κ????μ???reset()??????????????????????????????
????2??????????
????·public static MockControl createNiceControl(...);
????·public static MockControl createControl(...);
????·public static MockControl createStrictControl(...);
????Mocquer????????MockControl?????????????????????????????????????????????и?????????????????????????з????????????????????MockControl???????MockControl????????????????α?????з???????????????δ??????????????????????????????????????????????????MockControl??????MockControl???Щ??δ??????????????AssertionFailedError????????MockControl??????????α???????????·????????????????????????????AssertionFailedError?????±????????????MockControl??????
????????????????????????????????汾??
????public static MockControl createXXXControl(Class clazz); public static MockControl createXXXControl(Class clazz??     Class[] argTypes?? Object[] args);????????????????????????????????????????????????????????汾?????????á??????????汾??????????????????????????????????????磬???? ClassWithNoDefaultConstructor????????????????????     public class ClassWithNoDefaultConstructor {       public ClassWithNoDefaultConstructor(int i) {         ...       }       ...     }·α??????????
????public Object getMock();
????????MockControl????????????α????????á?????????????????????????α??????????????????????
????//get mock control     MockControl control = MockControl.createControl(Foo.class);     //Get the mock object from mock control     Foo foo = (Foo) control.getMock();·??????巽??
????public void setReturnValue(... value);
????public void setThrowable(Throwable throwable);
????public void setVoidCallable();
????public void setDefaultReturnValue(... value);
????public void setDefaultThrowable(Throwable throwable);
????public void setDefaultVoidCallable();
????public void setMatcher(ArgumentsMatcher matcher);
????public void setDefaultMatcher(ArgumentsMatcher matcher);
????MockControl??????????????α????????????????????