package jp.co.hnj.framework.unit;
import java.util.List;
import org.apache.poi.hssf.record.formula.functions.T;
import org.seasar.extension.dataset.DataTable;
import org.seasar.framework.exception.SRuntimeException;
import org.seasar.framework.unit.DataAccessor;
import org.seasar.framework.unit.impl.DataAccessorImpl;
/**
* @author Administrator
*
*/
public class MockInterceptor extends
org.seasar.framework.aop.interceptors.MockInterceptor {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
private DataAccessor accessor = new DataAccessorImpl();
private MockParser parser ;
public MockInterceptor() {
System.out.println("##");
}
public void setReturnValue(String methodName, String sheetPath, Class<T> dtoClazz) {
DataTable dataTable = accessor.readXls(sheetPath).getTable(0);
parser = new MockParserImpl(dtoClazz, dataTable);
try {
List<?> returnValue = parser.parse();
super.setReturnValue(methodName, returnValue.get(0));
} catch (Exception e) {
e.printStackTrace();
throw new SRuntimeException("");
}
}
public void setReturnListValue(String methodName, String sheetPath, Class<T> dtoClazz) {
DataTable dataTable = accessor.readXls(sheetPath).getTable(0);
parser = new MockParserImpl(dtoClazz, dataTable);
try {
List<?> returnValue = parser.parse();
super.setReturnValue(methodName, returnValue);
} catch (Exception e) {
e.printStackTrace();
throw new SRuntimeException("");
}
}
}
댓글 없음:
댓글 쓰기