private static void initTests() {
int t = 0;
int q = 0;
try (Scanner scanner = new Scanner(testsFile)) {
Test test = null;
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
if (line.startsWith(REGISTRATION_OPEN)) {
parseRegistrationOpen(line);
} else if (line.startsWith(CURRENT_TEST)) {
parseCurrentTest(line);
} else if (line.startsWith(NUMBER_OF_PLAYERS_TO_ELIMININATE)) {
parseNumberOfPlayersToEliminate(line);
} else if (line.startsWith(WIE_IS_DE_MOL)) {
parseWieIsDeMol(line);
} else if (line.startsWith(TEST)) {
test = new Test(line);
tests.add(test);
t++;
} else if (line.startsWith(QUESTION)) {
if (test == null) {
throw new IllegalArgumentException(String.format("Found %s without %s: %s", QUESTION, TEST, line));
}
Question question = Question.getInstance(line);
test.getQuestions().add(question);
q++;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();