Jmock简单例子
??? // 建立一个test上下文对象。
??? Mockery context = new Mockery();
??? // 生成一个mock对象
??? final LogDao logDao = context.mock(LogDao.class);
??? final int result = 26;
??? @Test
??? public void testGetCounts() throws Exception {
??????? context.checking(new Expectations() {{
??????????? oneOf(logDao).findCounts();
??????????? will(returnValue(26));
??????? }});
??????? LogServiceImp logServiceImp = new LogServiceImp();
??????? logServiceImp.setLogDao(logDao);
??????? int r = logServiceImp.getCounts();
??????? Assert.assertEquals(r, result);