Пример #1
0
  /**
   * Tests the '{@link
   * no.hal.pg.quiz.runtime.service.QuizTaskService#proposeAnswer(no.hal.pg.runtime.Player,
   * no.hal.pg.quiz.model.QA, java.lang.String) <em>Propose Answer</em>}' operation.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see no.hal.pg.quiz.runtime.service.QuizTaskService#proposeAnswer(no.hal.pg.runtime.Player,
   *     no.hal.pg.quiz.model.QA, java.lang.String)
   * @generated NOT
   */
  public void testProposeAnswer__QA_String() {
    QuizTaskService service = getFixture();
    QuizTask quizTask = service.getContext();
    quizTask.start();

    Player player = quizTask.getAllPlayers().get(0);
    service.setSubject(player.getPerson());
    assertNull(service.proposeAnswer(quizTask.getProposals().get(0).getQa(), "Hallvard"));
    QuizTaskTest.checkProposeAnswer(quizTask, 0, null, 0, false);

    assertNull(service.proposeAnswer(quizTask.getProposals().get(3).getQa(), "true"));
    QuizTaskTest.checkProposeAnswer(quizTask, 3, null, 0, false);
  }
Пример #2
0
  /**
   * Tests the '{@link
   * no.hal.pg.quiz.runtime.service.QuizTaskService#getQAProposals(no.hal.pg.runtime.Player) <em>Get
   * QA Proposals</em>}' operation.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see no.hal.pg.quiz.runtime.service.QuizTaskService#getQAProposals(no.hal.pg.runtime.Player)
   * @generated NOT
   */
  public void testGetQAProposals__Player() {
    QuizTaskService service = getFixture();
    QuizTask quizTask = service.getContext();
    quizTask.start();

    EList<Player> players = quizTask.getGame().getAllPlayers();
    Player player1 = players.get(0), player2 = players.get(1);

    EList<QAProposal> proposals = quizTask.getProposals();
    // the first proposal is for the second player, the rest for the first
    proposals.get(0).getPlayers().add(players.get(1));

    EList<QAProposal> proposals1 = service.getQAProposals(player1);
    assertEquals(3, proposals1.size());
    assertTrue(
        proposals1.containsAll(
            Arrays.asList(proposals.get(1), proposals.get(2), proposals.get(3))));

    EList<QAProposal> proposals2 = service.getQAProposals(player2);
    assertEquals(1, proposals2.size());
    assertTrue(proposals2.containsAll(Arrays.asList(proposals.get(0))));
  }