zylTest


package zyl;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import com.enation.eop.resource.model.EopSite;
import com.enation.eop.sdk.context.EopContext;
import com.enation.framework.test.SpringTestSupport;
import com.enation.seveneast.model.ExamTypeDetail;
import com.enation.seveneast.model.Question;
import com.enation.seveneast.service.IExamTypeDetailManager;
import com.enation.seveneast.service.IPaperTeacherManager;

/**
* 订单测试
* @author zyl
*2010-4-6下午05:04:30
*/
public class zylTest extends SpringTestSupport {
private IExamTypeDetailManager examTypeDetailManager;
private IPaperTeacherManager paperTeacherManager;
private String sessionid = "AC95B4420D5CE0C61BC98F99E6700B74";
@Before
public void mock(){
examTypeDetailManager= this.getBean("examTypeDetailManager");
paperTeacherManager= this.getBean("paperTeacherManager");


EopSite site = new EopSite();
site.setUserid(2);
site.setId(2);
EopContext context = new EopContext();
context.setCurrentSite(site);
EopContext.setContext(context);

}




@Test
public void test(){
List questionlist = paperTeacherManager.getStudentPaper(1);
System.out.print(questionlist.toString());
Map map=new HashMap();
for(Question q:questionlist){
//1单选 2多选 3判断4 填空 5简答6 论述
List examTypeDetailList =examTypeDetailManager.findByTid(3);


for(ExamTypeDetail type:examTypeDetailList){

if(type.getTdid()==q.getTypes()){
String name=type.getName();

if(map.containsKey(name)){
Integer i=map.get(name);
map.put(name, ++i);
}else{
map.put(name, 1);
};

};
}
System.out.println(map.toString());

}

}
}

你可能感兴趣的:(java)