Ejemplo n.º 1
0
  @Test
  public void TestMoodCalculatorWithNegativeVotes() {
    VoteCounter voteContainer =
        new VoteCounter(TopicContainer.GetTopicContainer(CountryTopics.class).Denmark);

    voteContainer.AddVote(1);
    voteContainer.AddVote(1);
    voteContainer.AddVote(1);
    voteContainer.AddVote(1);
    voteContainer.AddVote(1);
    voteContainer.AddVote(1);

    voteContainer.AddVote(2);
    voteContainer.AddVote(2);

    voteContainer.AddVote(3);

    Topic newTopic = voteContainer.GetNextTopic(9);

    String expected =
        TopicContainer.GetTopicContainer(CountryTopics.class).Denmark.GetParent(2).toString();
    String results = "";

    results = newTopic.toString();

    Assert.assertEquals(expected, results);
  }
Ejemplo n.º 2
0
  @Test
  public void TestMoodCalculatorWithPositiveVotes() {
    TopicContainer.GetTopicContainer(MovieTopics.class).Scifi.VisitTopic();

    VoteCounter voteContainer =
        new VoteCounter(TopicContainer.GetTopicContainer(MovieTopics.class).Scifi);

    voteContainer.AddVote(2);
    voteContainer.AddVote(2);
    voteContainer.AddVote(3);

    Topic newTopic = voteContainer.GetNextTopic(3);
    String results = newTopic.toString();

    boolean isCorrect = false;
    if (results.equalsIgnoreCase(
        TopicContainer.GetTopicContainer(MovieTopics.class).StarWars.toString())) isCorrect = true;
    if (results.equalsIgnoreCase(
        TopicContainer.GetTopicContainer(MovieTopics.class).Gravity.toString())) isCorrect = true;

    Assert.assertTrue(isCorrect);
  }