parent
cc432df3b4
commit
a455c7db4a
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
After Width: | Height: | Size: 27 MiB |
After Width: | Height: | Size: 1.2 MiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 134 KiB |
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/点名.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>点点小助手</title>
|
||||
<script type="module" crossorigin src="/assets/index-Cb5FnDWH.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B1hDzaLh.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 649 KiB |
After Width: | Height: | Size: 1.9 KiB |
@ -1,13 +0,0 @@
|
||||
package com.example.attendance;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class AttendanceApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
package com.example.attendance;
|
||||
|
||||
import com.example.attendance.entity.RollCallResponse;
|
||||
import com.example.attendance.entity.RollCallSettings;
|
||||
import com.example.attendance.entity.Student;
|
||||
import com.example.attendance.service.impl.RollCallServiceImpl;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class RollCallServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private RollCallServiceImpl rollCallService;
|
||||
|
||||
private List<Student> students;
|
||||
private RollCallSettings settings;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
|
||||
// 模拟学生列表
|
||||
students = Arrays.asList(
|
||||
createStudent("1", "Alice", 50),
|
||||
createStudent("2", "Bob", 90),
|
||||
createStudent("3", "Charlie", 30)
|
||||
);
|
||||
|
||||
// 初始化点名设置
|
||||
settings = new RollCallSettings();
|
||||
settings.setRollCall(true);
|
||||
settings.setTriggerRandomEvent(false);
|
||||
settings.setWheelOfFortune(false);
|
||||
}
|
||||
|
||||
// 测试正常点名模式
|
||||
@Test
|
||||
void testStartRollCall_NormalMode() {
|
||||
RollCallResponse response = rollCallService.startRollCall(students, settings);
|
||||
|
||||
// 控制台输出
|
||||
System.out.println("Test: Normal Mode");
|
||||
System.out.println("Student ID: " + response.getStudentId());
|
||||
System.out.println("Message: " + response.getMessage());
|
||||
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getStudentId());
|
||||
assertTrue(response.getMessage().contains("没有触发随机事件"));
|
||||
}
|
||||
|
||||
// 测试提问模式
|
||||
@Test
|
||||
void testStartRollCall_QuestionMode() {
|
||||
settings.setRollCall(false); // 设置为提问模式
|
||||
RollCallResponse response = rollCallService.startRollCall(students, settings);
|
||||
|
||||
// 控制台输出
|
||||
System.out.println("Test: Question Mode");
|
||||
System.out.println("Student ID: " + response.getStudentId());
|
||||
System.out.println("Message: " + response.getMessage());
|
||||
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getStudentId());
|
||||
assertTrue(response.getMessage().contains("没有触发随机事件"));
|
||||
}
|
||||
|
||||
// 测试命运轮盘模式
|
||||
@Test
|
||||
void testStartRollCall_WheelOfFortune() {
|
||||
settings.setWheelOfFortune(true); // 开启命运轮盘
|
||||
|
||||
RollCallResponse response = rollCallService.startRollCall(students, settings);
|
||||
|
||||
// 控制台输出
|
||||
System.out.println("Test: Wheel of Fortune Mode");
|
||||
System.out.println("Student ID: " + response.getStudentId());
|
||||
System.out.println("Message: " + response.getMessage());
|
||||
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getStudentId());
|
||||
assertTrue(response.getMessage().contains("命运轮盘"));
|
||||
}
|
||||
|
||||
// 测试触发随机事件
|
||||
@Test
|
||||
void testStartRollCall_TriggerRandomEvent() {
|
||||
settings.setTriggerRandomEvent(true); // 触发随机事件
|
||||
|
||||
RollCallResponse response = rollCallService.startRollCall(students, settings);
|
||||
|
||||
// 控制台输出
|
||||
System.out.println("Test: Random Event Triggered");
|
||||
System.out.println("Student ID: " + response.getStudentId());
|
||||
System.out.println("Message: " + response.getMessage());
|
||||
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getStudentId());
|
||||
assertTrue(response.getMessage().contains("触发了随机事件"));
|
||||
}
|
||||
|
||||
// 辅助方法,创建学生
|
||||
private Student createStudent(String id, String name, int points) {
|
||||
Student student = new Student();
|
||||
student.setStudentNumber(id);
|
||||
student.setName(name);
|
||||
student.setPoints(BigDecimal.valueOf(points));
|
||||
return student;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="main" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in new issue