/** 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);
  }
  /** Tests the getArticle function */
  public void testGetArticle() {
    Newsletter newsletter = new Newsletter("BFH Newsletter", "blablabla", 6);
    Article article1 =
        newsletter.addArticle("Article 1", "The newsletter project is really funny ;)");

    assertTrue(article1.equals(newsletter.getArticle(article1.getId())));
  }
  /** Tests the addArticle function */
  public void testAddArticle() {
    Newsletter newsletter = new Newsletter("BFH Newsletter", "blablabla", 6);
    Article article =
        newsletter.addArticle("NewsletterArticle", "The newsletter project is really funny ;)");

    assertTrue("NewsletterArticle".equals(newsletter.getArticle(article.getId()).getTitle()));
  }
  /** test the getArticleText function */
  public void testGetArticleText() {
    NewsletterCollection newsletterCollection = NewsletterCollection.getInstance();

    String newsletter1 = newsletterCollection.add("Newsletter1", "blablabla", 6);
    Article article =
        newsletterCollection.getNewsletter(newsletter1).addArticle("Article1", "blablabla");

    ArticleController controller = new ArticleController();
    assertTrue("blablabla".equals(controller.getArticleText(newsletter1, article.getId())));
  }