ExperimentalClassService单元测试

master
shijie 4 years ago
parent 9571b7c766
commit 6e8e98e27a
  1. 14
      src/main/java/com/yipin/liuwanr/entity/Industry.java
  2. 11
      src/main/java/com/yipin/liuwanr/entity/IndustryClass.java
  3. 86
      src/main/java/com/yipin/liuwanr/entity/Student.java
  4. 157
      src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java

@ -13,19 +13,33 @@ public class Industry {
public Integer getIndustryId() { public Integer getIndustryId() {
return industryId; return industryId;
} }
public void setIndustryId(Integer industryId) { public void setIndustryId(Integer industryId) {
this.industryId = industryId; this.industryId = industryId;
} }
public Integer getIndustryClassId() { public Integer getIndustryClassId() {
return industryClassId; return industryClassId;
} }
public void setIndustryClassId(Integer industryClassId) { public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId; this.industryClassId = industryClassId;
} }
public String getIndustryName() { public String getIndustryName() {
return industryName; return industryName;
} }
public void setIndustryName(String industryName) { public void setIndustryName(String industryName) {
this.industryName = industryName; this.industryName = industryName;
} }
@Override
public String toString() {
return "Industry{" +
"industryId=" + industryId +
", industryClassId=" + industryClassId +
", industryName='" + industryName + '\'' +
'}';
}
} }

@ -11,13 +11,24 @@ public class IndustryClass {
public Integer getIndustryClassId() { public Integer getIndustryClassId() {
return industryClassId; return industryClassId;
} }
public void setIndustryClassId(Integer industryClassId) { public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId; this.industryClassId = industryClassId;
} }
public String getIndustryClassName() { public String getIndustryClassName() {
return industryClassName; return industryClassName;
} }
public void setIndustryClassName(String industryClassName) { public void setIndustryClassName(String industryClassName) {
this.industryClassName = industryClassName; this.industryClassName = industryClassName;
} }
@Override
public String toString() {
return "IndustryClass{" +
"industryClassId=" + industryClassId +
", industryClassName='" + industryClassName + '\'' +
'}';
}
} }

@ -60,163 +60,249 @@ public class Student {
public String getStuProfessionalArchitectureName() { public String getStuProfessionalArchitectureName() {
return stuProfessionalArchitectureName; return stuProfessionalArchitectureName;
} }
public void setStuProfessionalArchitectureName(String stuProfessionalArchitectureName) { public void setStuProfessionalArchitectureName(String stuProfessionalArchitectureName) {
this.stuProfessionalArchitectureName = stuProfessionalArchitectureName; this.stuProfessionalArchitectureName = stuProfessionalArchitectureName;
} }
public String getAttendance() { public String getAttendance() {
return attendance; return attendance;
} }
public void setAttendance(String attendance) { public void setAttendance(String attendance) {
this.attendance = attendance; this.attendance = attendance;
} }
public Integer getLoginNumber() { public Integer getLoginNumber() {
return loginNumber; return loginNumber;
} }
public void setLoginNumber(Integer loginNumber) { public void setLoginNumber(Integer loginNumber) {
this.loginNumber = loginNumber; this.loginNumber = loginNumber;
} }
public String getLastLoginTime() { public String getLastLoginTime() {
return lastLoginTime; return lastLoginTime;
} }
public void setLastLoginTime(String lastLoginTime) { public void setLastLoginTime(String lastLoginTime) {
this.lastLoginTime = lastLoginTime; this.lastLoginTime = lastLoginTime;
} }
public String getClassName() { public String getClassName() {
return className; return className;
} }
public void setClassName(String className) { public void setClassName(String className) {
this.className = className; this.className = className;
} }
public Integer getIntExperimentalClassId() { public Integer getIntExperimentalClassId() {
return intExperimentalClassId; return intExperimentalClassId;
} }
public void setIntExperimentalClassId(Integer intExperimentalClassId) { public void setIntExperimentalClassId(Integer intExperimentalClassId) {
this.intExperimentalClassId = intExperimentalClassId; this.intExperimentalClassId = intExperimentalClassId;
} }
public String getStudentNameNumber() { public String getStudentNameNumber() {
return studentNameNumber; return studentNameNumber;
} }
public void setStudentNameNumber(String studentNameNumber) { public void setStudentNameNumber(String studentNameNumber) {
this.studentNameNumber = studentNameNumber; this.studentNameNumber = studentNameNumber;
} }
public String getProfessionalName() { public String getProfessionalName() {
return professionalName; return professionalName;
} }
public void setProfessionalName(String professionalName) { public void setProfessionalName(String professionalName) {
this.professionalName = professionalName; this.professionalName = professionalName;
} }
public String getGradeName() { public String getGradeName() {
return gradeName; return gradeName;
} }
public void setGradeName(String gradeName) { public void setGradeName(String gradeName) {
this.gradeName = gradeName; this.gradeName = gradeName;
} }
public String getProfessionalIds() { public String getProfessionalIds() {
return professionalIds; return professionalIds;
} }
public void setProfessionalIds(String professionalIds) { public void setProfessionalIds(String professionalIds) {
this.professionalIds = professionalIds; this.professionalIds = professionalIds;
} }
public String getGradeIds() { public String getGradeIds() {
return gradeIds; return gradeIds;
} }
public void setGradeIds(String gradeIds) { public void setGradeIds(String gradeIds) {
this.gradeIds = gradeIds; this.gradeIds = gradeIds;
} }
public String getClassIds() { public String getClassIds() {
return classIds; return classIds;
} }
public void setClassIds(String classIds) { public void setClassIds(String classIds) {
this.classIds = classIds; this.classIds = classIds;
} }
public String getSearchContent() { public String getSearchContent() {
return searchContent; return searchContent;
} }
public void setSearchContent(String searchContent) { public void setSearchContent(String searchContent) {
this.searchContent = searchContent; this.searchContent = searchContent;
} }
public String getUniqueIdentificationAccount() { public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount; return uniqueIdentificationAccount;
} }
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount; this.uniqueIdentificationAccount = uniqueIdentificationAccount;
} }
public Integer getStudentId() { public Integer getStudentId() {
return studentId; return studentId;
} }
public void setStudentId(Integer studentId) { public void setStudentId(Integer studentId) {
this.studentId = studentId; this.studentId = studentId;
} }
public String getStudentName() { public String getStudentName() {
return studentName; return studentName;
} }
public void setStudentName(String studentName) { public void setStudentName(String studentName) {
this.studentName = studentName; this.studentName = studentName;
} }
public String getStudentNumber() { public String getStudentNumber() {
return studentNumber; return studentNumber;
} }
public void setStudentNumber(String studentNumber) { public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber; this.studentNumber = studentNumber;
} }
public String getPhone() { public String getPhone() {
return phone; return phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
this.phone = phone; this.phone = phone;
} }
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public Integer getRoleId() { public Integer getRoleId() {
return roleId; return roleId;
} }
public void setRoleId(Integer roleId) { public void setRoleId(Integer roleId) {
this.roleId = roleId; this.roleId = roleId;
} }
public Integer getSchoolId() { public Integer getSchoolId() {
return schoolId; return schoolId;
} }
public void setSchoolId(Integer schoolId) { public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId; this.schoolId = schoolId;
} }
public Integer getProfessionalId() { public Integer getProfessionalId() {
return professionalId; return professionalId;
} }
public void setProfessionalId(Integer professionalId) { public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId; this.professionalId = professionalId;
} }
public Integer getGradeId() { public Integer getGradeId() {
return gradeId; return gradeId;
} }
public void setGradeId(Integer gradeId) { public void setGradeId(Integer gradeId) {
this.gradeId = gradeId; this.gradeId = gradeId;
} }
public Integer getClassId() { public Integer getClassId() {
return classId; return classId;
} }
public void setClassId(Integer classId) { public void setClassId(Integer classId) {
this.classId = classId; this.classId = classId;
} }
public String getExperimentalClassName() { public String getExperimentalClassName() {
return experimentalClassName; return experimentalClassName;
} }
public void setExperimentalClassName(String experimentalClassName) { public void setExperimentalClassName(String experimentalClassName) {
this.experimentalClassName = experimentalClassName; this.experimentalClassName = experimentalClassName;
} }
public String getExperimentalClassId() { public String getExperimentalClassId() {
return experimentalClassId; return experimentalClassId;
} }
public void setExperimentalClassId(String experimentalClassId) { public void setExperimentalClassId(String experimentalClassId) {
this.experimentalClassId = experimentalClassId; this.experimentalClassId = experimentalClassId;
} }
public Integer getIsAssess() { public Integer getIsAssess() {
return isAssess; return isAssess;
} }
public void setIsAssess(Integer isAssess) { public void setIsAssess(Integer isAssess) {
this.isAssess = isAssess; this.isAssess = isAssess;
} }
@Override
public String toString() {
return "Student{" +
"studentId=" + studentId +
", studentName='" + studentName + '\'' +
", studentNumber='" + studentNumber + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", roleId=" + roleId +
", schoolId=" + schoolId +
", professionalId=" + professionalId +
", gradeId=" + gradeId +
", classId=" + classId +
", experimentalClassName='" + experimentalClassName + '\'' +
", experimentalClassId='" + experimentalClassId + '\'' +
", isAssess=" + isAssess +
", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' +
", searchContent='" + searchContent + '\'' +
", professionalIds='" + professionalIds + '\'' +
", gradeIds='" + gradeIds + '\'' +
", classIds='" + classIds + '\'' +
", professionalName='" + professionalName + '\'' +
", gradeName='" + gradeName + '\'' +
", studentNameNumber='" + studentNameNumber + '\'' +
", intExperimentalClassId=" + intExperimentalClassId +
", className='" + className + '\'' +
", loginNumber=" + loginNumber +
", lastLoginTime='" + lastLoginTime + '\'' +
", attendance='" + attendance + '\'' +
", stuProfessionalArchitectureName='" + stuProfessionalArchitectureName + '\'' +
'}';
}
} }

@ -0,0 +1,157 @@
package com.yipin.liuwanr;
import com.yipin.liuwanr.entity.ExperimentalClass;
import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.service.ExperimentalClassService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ExperimentalClassServiceTest {
@Autowired
private ExperimentalClassService experimentalClassService;
//添加客户
@Test
@Transactional
public void experimentClassAddStudent() {
List<Student> studentList = new ArrayList<>();
Student stu = new Student();
stu.setStudentId(1);
stu.setExperimentalClassId("123");
studentList.add(stu);
HashMap<String, Object> map = experimentalClassService.experimentClassAddStudent(studentList);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//实验班级删除学生
@Test
@Transactional
public void experimentClassDeleteStudent() {
List<Student> studentList = new ArrayList<>();
Student stu = new Student();
stu.setStudentId(1);
stu.setExperimentalClassId("123");
studentList.add(stu);
HashMap<String, Object> map = experimentalClassService.experimentClassDeleteStudent(studentList);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//创建实验班级
@Test
@Transactional
public void addExperimentalClass() {
ExperimentalClass experimentalClass = new ExperimentalClass();
experimentalClass.setExperimentalClassName("测试");
experimentalClass.setClassSize(12);
experimentalClass.setFounder("测试");
experimentalClass.setCourseId(2);
experimentalClass.setUserId(2);
experimentalClass.setSchoolId(2);
HashMap<String, Object> map = experimentalClassService.addExperimentalClass(experimentalClass);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
public void queryExperimentalClass() {
Integer schoolId = 1;
Integer courseId = 2;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClass(schoolId, courseId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询实验班级专业
@Test
public void queryExperimentalClassSP() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClassSP(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询学生行政班级
@Test
public void queryStudentClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.queryStudentClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
/**
* 班级详情
*/
@Test
public void queryExperimentalClassDetails() {
Student student = new Student();
Integer courseId = 1;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClassDetails(student, courseId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//新增学生显示数据
@Test
public void queryexperimentalClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.queryexperimentalClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//专业下拉框
@Test
public void getProfessionals() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.getProfessionals(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//班级下拉框
@Test
public void getStudentClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.getStudentClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
@Transactional
public void deleteExperimentalClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.deleteExperimentalClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
@Transactional
public void updateExperimentalClass() {
ExperimentalClass experimentalClass = new ExperimentalClass();
HashMap<String, Object> map = experimentalClassService.updateExperimentalClass(experimentalClass);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//修改实验班级名称
@Test
@Transactional
public void updateExperimentClassName() {
ExperimentalClass experimentalClass = new ExperimentalClass();
HashMap<String, Object> map = experimentalClassService.updateExperimentalClass(experimentalClass);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//——————————————————————————————全承珠
@Test
public void queryGetByExperimentalClassName() {
String experimentalClassName = "";
HashMap<String, Object> map = experimentalClassService.queryGetByExperimentalClassName(experimentalClassName);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
}
Loading…
Cancel
Save