Package zendeskapi.models.forums

Examples of zendeskapi.models.forums.IndividualForumResponse


  @Test
  public void testCreateForum() throws Exception {
    Forum forum = new Forum();
    forum.setName("Test forum 1");
    IndividualForumResponse individualForumResponse = API.getForums().createForum(forum);
    Forum responseForum = individualForumResponse.getForum();
    Assert.assertEquals(responseForum.getName(), forum.getName());
    forumIds.add(responseForum.getId());
  }
View Full Code Here


  @Test
  public void testGetForumById() throws Exception {
    GroupForumResponse groupForumResponse = API.getForums().getForums();
    Forum forum = groupForumResponse.getForums().get(0);
    IndividualForumResponse individualForumResponse = API.getForums().getForumById(forum.getId());
    Assert.assertEquals(individualForumResponse.getForum().getDescription(), forum.getDescription());
    Assert.assertEquals(individualForumResponse.getForum().getId(), forum.getId());
  }
View Full Code Here

  @Test
  public void testDeleteForum() throws Exception {
    Forum forum = new Forum();
    forum.setName("Test forum 1");
    IndividualForumResponse individualForumResponse = API.getForums().createForum(forum);
    Forum responseForum = individualForumResponse.getForum();
    Assert.assertTrue(API.getForums().deleteForum(responseForum.getId()));
  }
View Full Code Here

  @Test
  public void testUpdateForum() throws Exception {
    Forum forum = new Forum();
    forum.setName("Test forum 1");
    IndividualForumResponse individualForumResponse = API.getForums().createForum(forum);
    forumIds.add(individualForumResponse.getForum().getId());
    Forum responseForum = individualForumResponse.getForum();
    responseForum.setName("Test update forum 1");
    individualForumResponse = API.getForums().updateForum(responseForum);
    responseForum = individualForumResponse.getForum();
    Assert.assertEquals(responseForum.getName(), "Test update forum 1");
  }
View Full Code Here

    Category responseCategory = individualCategoryResponse.getCategory();
   
    Forum forum = new Forum();
    forum.setName("Test forum 1");
    forum.setCategoryId(responseCategory.getId());
    IndividualForumResponse individualForumResponse = API.getForums().createForum(forum);
   
    forumIds.add(individualForumResponse.getForum().getId());
   
    GroupForumResponse groupForumResponse = API.getForums().getForumsByCategory(responseCategory.getId());
    List<Forum> forums = groupForumResponse.getForums();
    for (Forum f : forums) {
      Assert.assertEquals(f.getCategoryId(), responseCategory.getId());
View Full Code Here

  private GroupForumResponse createForums() throws ZendeskApiException {
    Forum forum = new Forum();
    for (int i = 0; i < 5; i++) {
      forum.setName("Test forum " + i);
      IndividualForumResponse individualForumResponse = API.getForums().createForum(forum);
      Forum responseForum = individualForumResponse.getForum();
      Assert.assertEquals(responseForum.getName(), forum.getName());
      forumIds.add(responseForum.getId());
    }
    return API.getForums().getForums();
  }
View Full Code Here

   * @param forum
   * @return IndividualForumResponse
   * @throws ZendeskApiException
   */
  public IndividualForumResponse createForum(Forum forum) throws ZendeskApiException {
    IndividualForumResponse forumToCreate = new IndividualForumResponse();
    forumToCreate.setForum(forum);
    try {
      return genericPost("forums.json", forumToCreate, IndividualForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Creation of forum " + forum.getName() + " failed", e);
    }
View Full Code Here

   * @param forum
   * @return IndividualForumResponse
   * @throws ZendeskApiException
   */
  public IndividualForumResponse updateForum(Forum forum) throws ZendeskApiException {
    IndividualForumResponse forumToUpdate = new IndividualForumResponse();
    forumToUpdate.setForum(forum);
    try {
      return genericPut("forums/" + forum.getId(), forumToUpdate, IndividualForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Updating forum " + forum.getName() + " failed", e);
    }
View Full Code Here

TOP

Related Classes of zendeskapi.models.forums.IndividualForumResponse

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.