コード例 #1
0
  @Test
  public void testReblog() throws DataNotFoundException {
    postingService.writePosting("first_blog", testMixedPosting1);
    postingService.reblog(testMember2, "first_blog", 1, "third_blog");

    Posting reblogedPosting = postingService.findPosting("third_blog", 1);
    assertEquals(reblogedPosting.getTitle(), testMixedPosting1.getTitle());
    assertEquals(
        reblogedPosting.getWriter(),
        testMixedPosting1.getWriter() + " >> " + testMember2.getName());
    assertEquals(reblogedPosting.getContentType(), testMixedPosting1.getContentType());
    assertEquals(reblogedPosting.getExposure(), testMixedPosting1.getExposure());
    assertEquals(reblogedPosting.getTags(), testMixedPosting1.getTags());
    assertEquals(reblogedPosting.getPostingType(), testMixedPosting1.getPostingType());
    assertEquals(reblogedPosting.getReblogOption(), testMixedPosting1.getReblogOption());

    postingService.removePosting("first_blog", 1);
    postingService.removePosting("third_blog", 1);
  }
コード例 #2
0
  @Test(expected = DataNotFoundException.class)
  public void testPostingWriteFindDelete() throws DataNotFoundException {
    postingService.writePosting("first_blog", testMixedPosting1);
    postingService.writePosting("first_blog", testTextPosting1);
    postingService.writePosting("first_blog", testSinglePosting1);
    postingService.writePosting("second_blog", testMixedPosting3);
    postingService.writePosting("second_blog", testTextPosting3);
    postingService.writePosting("second_blog", testSinglePosting3);

    Posting tempPosting = postingService.findPosting("first_blog", 1);

    assertEquals(testMixedPosting1.getWriter(), tempPosting.getWriter());
    assertEquals(testMixedPosting1.getTitle(), tempPosting.getTitle());
    assertEquals(testMixedPosting1.getContentType(), tempPosting.getContentType());
    assertEquals(testMixedPosting1.getExposure(), tempPosting.getExposure());
    assertEquals(testMixedPosting1.getTags(), tempPosting.getTags());
    assertEquals(testMixedPosting1.getPostingType(), tempPosting.getPostingType());
    assertEquals(testMixedPosting1.getReblogOption(), tempPosting.getReblogOption());

    PostingContent originContent = testMixedPosting1.getContents();
    PostingContent compareContent = tempPosting.getContents();
    assertEquals(originContent.getTextContent(), compareContent.getTextContent());

    String[] originFiles = originContent.getFilePaths();
    String[] compareFiles = compareContent.getFilePaths();
    for (int i = 0; i < originFiles.length; i++) {
      assertEquals(originFiles[i], compareFiles[i]);
    }

    postingService.removePosting("first_blog", 1);
    postingService.removePosting("first_blog", 2);
    postingService.removePosting("first_blog", 3);
    postingService.removePosting("second_blog", 1);
    postingService.removePosting("second_blog", 2);
    postingService.removePosting("second_blog", 3);

    tempPosting = postingService.findPosting("second_blog", 2);
  }
コード例 #3
0
  @Test
  public void testReply() throws DataNotFoundException {
    postingService.writePosting("first_blog", testMixedPosting1);

    postingService.replyPosting("first_blog", reply1, 1);
    postingService.replyPosting("first_blog", reply2, 1);
    postingService.replyPosting("first_blog", reply3, 1);

    Posting[] replies = postingService.getReplies("first_blog", 1);
    assertEquals(3, replies.length);
    assertEquals(reply1.getWriter(), replies[0].getWriter());
    assertEquals(reply1.getContentType(), replies[0].getContentType());
    assertEquals(reply1.getExposure(), replies[0].getExposure());
    assertEquals(reply1.getTags(), replies[0].getTags());
    assertEquals(reply1.getPostingType(), replies[0].getPostingType());
    assertEquals(reply1.getReblogOption(), replies[0].getReblogOption());

    postingService.removePosting("first_blog", 1);
  }