{
this.dao = dao;
}
public String operate()
{
List list = dao.execute("select * from tbl_test");
return (String) list.get(0);
}
}
//BusinessTest.java
package com.raistlin.test.jmock
import org.jmock.cglib.MockObjectTestCase;
import org.jmock.cglib.Mock;
public class BusinessTest extends MockObjectTestCase
{
private Mock mockDao = null;
private Business business = null;
protected void setUp() throws Exception
{
super.setUp();
mockDao = new Mock(Dao.class);
business = new Business();
}
protected void tearDown() throws Exception
文章来源于领测软件测试网 https://www.ltesting.net/