Package nl.nuggit.moltest.model

Examples of nl.nuggit.moltest.model.Test


  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();
View Full Code Here


      viewIndex(request, response, "Je bent niet ingelogd");
      return;
    }
    Result result = (Result) request.getSession().getAttribute("result");
    if (result == null) {
      Test currentTest = DataService.findTest(DataService.currentTestId);
      if (currentTest == null) {
        throw new IllegalArgumentException("Er is geen test gaande");
      }
      result = new Result(player, currentTest);
      request.getSession().setAttribute("result", result);
View Full Code Here

TOP

Related Classes of nl.nuggit.moltest.model.Test

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.