目前我写了一个小的downloadService,让用户下载一个文件(目前只有excel).代码工作正常,但我不知道如何为它编写单元测试.那是我的代码:
package com.pzm.service;
import com.pzm.model.UserBillingsMock;
import com.pzm.model.report.ExcelReport;
import com.pzm.model.report.Report;
import com.pzm.model.report.ReportFactory;
import org.springframework.stereotype.Repository;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* Created by akfaz on 6/26/14.
*/
@Repository
public class DownloadService {
private Report report;
private List userBillings;
public void setBill(List userBillings) {
this.userBillings = userBillings;
}
public void download(HttpServletResponse response, String reportType) {