Exemplo n.º 1
0
  /** Tests the setArticleToOpenIssue function */
  public void testLinkArticles() {

    Newsletter newsletter = new Newsletter("BFH Newsletter", "blablabla", 6);
    Issue issue = newsletter.compileIssueAndCreateNew(2007, new Date());

    Article article1 =
        newsletter.addArticle("Article 1", "The newsletter project is really funny ;)");
    Article article2 =
        newsletter.addArticle("Article 2", "The newsletter project is really funny ;)");
    Article article3 =
        newsletter.addArticle("Article 3", "The newsletter project is really funny ;)");

    newsletter.setArticleToOpenIssue(article1.getId());
    newsletter.setArticleToOpenIssue(article2.getId());

    Map unlinkedArticles = newsletter.getUnlinkedArticles();
    Map issueArticles = issue.getArticles();

    assertFalse(unlinkedArticles.containsValue(article1));
    assertFalse(unlinkedArticles.containsValue(article2));
    assertTrue(unlinkedArticles.containsValue(article3));
    assertTrue(unlinkedArticles.size() == 1);

    assertTrue(issueArticles.containsValue(article1));
    assertTrue(issueArticles.containsValue(article2));
    assertFalse(issueArticles.containsValue(article3));
    assertTrue(issueArticles.size() == 2);
  }
Exemplo n.º 2
0
  /** Tests the compileIssueAndCreateNew function */
  public void testCompileIssueAndCreateNew() {
    Newsletter newsletter = new Newsletter("BFH Newsletter", "blablabla", 6);
    Issue issue = newsletter.compileIssueAndCreateNew(2007, new Date());

    assertTrue(issue.getYear() == 2007);
    assertTrue(issue.getId() == 200701);
  }