亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: easy testing using easymock [打印本頁(yè)]

作者: wangsong2    時(shí)間: 2006-03-23 09:34
標(biāo)題: easy testing using easymock
        to test the collaborating Classes, we used to use the mock objects, but it's really boring to write many mock objects, so the easymock can do this for me. to use the easymock, you have to :
  1: create the control for the collaborating interface
  2: get the mock object from the control
  3: record the hebavior of the mock
  4: replay it
  5: test the classes
  6: verify
  some to note here is: the collaborating class must implements some interface, and mock object create from interface(Using dynamic proxy in j2sdk).

example code:

       control = MockControl.createControl(Collaborator.class); // 1
       mock = (Collaborator) control.getMock(); // 2
       classUnderTest = new ClassUnderTest();
       classUnderTest.addListener(mock);
       // 3 (we do not expect anything)
       control.replay(); // 4
       control.verify(); //5


本文來自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/4241/showart_89528.html




歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2