Repository navigation
Expand file tree
/
Copy pathBackendTest.java
More file actions
29 lines (27 loc) · 1.71 KB
/
Copy pathBackendTest.java
File metadata and controls
29 lines (27 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 백엔드 자체 점검: java -ea BackendTest (프로젝트 폴더에서 실행)
public class BackendTest {
public static void main(String[] args) {
QuestionManager qm = new QuestionManager("questions.txt");
StageManager sm = new StageManager("monsters.txt");
assert sm.getAll().size() == 9 : "스테이지는 9개";
for (String topic : new String[]{"coding", "common", "name"})
for (int s = 1; s <= 3; s++) {
assert sm.findStage(topic, s) != null : topic + " " + s + " 보스 없음";
// 이름 맞추기 문제는 namequiz/name_quiz.txt에 있음 (NameQuizTest가 검사)
int expected = topic.equals("name") ? 0 : 10;
assert qm.findByStage(topic, s).size() == expected : topic + " " + s + " 문제는 " + expected + "개";
}
assert sm.findStage("CODING", 3).getBossName().equals("NullPointerException (Boss)");
assert sm.findStage("coding", 4) == null;
Stage common2 = DataLoader.loadStage("monsters.txt", "common", 2);
assert common2.getBossName().equals("상식 백과사전 (Lv.2)");
assert common2.getHpPercent() == 50 : "HP 비율은 monsters.txt 값";
assert common2.getBossHp(10) == 5 : "일반 보스: 문제 10개 → HP 5";
assert sm.findStage("coding", 3).getBossHp(10) == 7 : "마지막 보스: 문제 10개 → HP 7";
assert common2.getBossHp(1) == 1 : "HP는 최소 1";
assert DataLoader.loadStage("monsters.txt", "coding", 9).getBossName().equals("Unknown Boss");
qm.printAll();
sm.printAll();
System.out.println("OK: 문제 " + qm.getAll().size() + "개, 스테이지 " + sm.getAll().size() + "개");
}
}