Package cn.edu.zju.acm.onlinejudge.bean

Examples of cn.edu.zju.acm.onlinejudge.bean.Forum


   * Creates a new forum.
   * @param id the id
   * @return a new forum instance
   */
  private Forum newForum(long id) {
    Forum forum = new Forum();
    forum.setId(id);
    forum.setName("forum" + id);
    forum.setDescription("forum" + id + " description");
    return forum;
  }
View Full Code Here


       
    Set nameSet = new HashSet(Arrays.asList(new String[] {"forum1", "forum2", "forum3"}));   
    Set descSet = new HashSet(Arrays.asList(new String[] {
        "forum1 description", "forum2 description", "forum3 description"}));
    for (Iterator it = forums.iterator(); it.hasNext();) {
      Forum forum = (Forum) it.next();
      assertTrue("wrong name", nameSet.contains(forum.getName()));     
      assertTrue("wrong description", descSet.contains(forum.getDescription()));
      nameSet.remove(forum.getName());     
      descSet.remove(forum.getDescription());
     
    }
  }
View Full Code Here

   */
  public void testGetForum() throws Exception {   
   
    List forums = persistence.getAllForums();
    for (Iterator it = forums.iterator(); it.hasNext();) {
      Forum forum = (Forum) it.next();
      Forum forum1 = persistence.getForum(forum.getId());
      checkForum(forum, forum1);     
    }
  }
View Full Code Here

   * Tests createForum method
   * @throws Exception to JUnit
   */
  public void testCreateForum1() throws Exception {   
   
    Forum forum = new Forum();
    forum.setName("name");
    forum.setDescription("desc");
   
    persistence.createForum(forum, 1);
   
    Forum forum1 = persistence.getForum(forum.getId());
    checkForum(forum, forum1);   

  }
View Full Code Here

  /**
   * Tests createForum method
   * @throws Exception to JUnit
   */
  public void testCreateForum2() throws Exception {   
    Forum forum1 = new Forum();
    forum1.setName("name1");
    forum1.setDescription("desc1");
    Forum forum2 = new Forum();
    forum2.setName("name2");
    forum2.setDescription("desc2");
   
 
    persistence.createForum(forum1, 1);
    persistence.createForum(forum2, 1);
   
    Forum forum11 = persistence.getForum(forum1.getId());
    checkForum(forum1, forum11);
   
    Forum forum22 = persistence.getForum(forum2.getId());
    checkForum(forum2, forum22);

 
View Full Code Here

   
    forum1.setName("new name");
    forum1.setDescription("new desc");
    persistence.updateForum(forum1, 1);
   
    Forum forum11 = persistence.getForum(forum1.getId());
    checkForum(forum1, forum11);
   
  }
View Full Code Here

   * Tests updateForum method
   * @throws Exception to JUnit
   */
  public void testUpdateForum2() throws Exception
    try {
      Forum forum = new Forum();
      forum.setName("foo");
      forum.setDescription("bar");     
      persistence.updateForum(forum, 1);
      fail("PersistenceException should be thrown");
    } catch (PersistenceException pe) {     
      // ok
    }       
View Full Code Here

   * Creates a new forum.
   * @param id the id
   * @return a new forum instance
   */
  private Forum newForum(long id) {
    Forum forum = new Forum();
    forum.setId(id);
    forum.setName("forum" + id);
    forum.setDescription("forum" + id + " description");
    return forum;
  }
View Full Code Here

   * Creates a new forum.
   * @param id the id
   * @return a new forum instance
   */
  private Forum newForum(long id) {
    Forum forum = new Forum();
    forum.setId(id);
    forum.setName("forum" + id);
    forum.setDescription("forum" + id + " description");
    return forum;
  }
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.bean.Forum

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.