@Test
  public void testUpdatePosting() throws DataNotFoundException {
    String newTitle = "The new title.";
    String newTags = "#update";

    postingService.writePosting("first_blog", testMixedPosting1);

    Posting originPosting = postingService.findPosting("first_blog", 1);
    originPosting.setContents(mixedContent2);
    originPosting.setTitle(newTitle);
    originPosting.setTags(newTags);

    postingService.updatePosting("first_blog", originPosting);

    Posting changedPosting = postingService.findPosting("first_blog", 1);
    assertEquals(newTitle, changedPosting.getTitle());
    assertEquals(newTags, changedPosting.getTags());
    PostingContent changedContents = changedPosting.getContents();
    assertEquals(mixedContent2.getTextContent(), changedContents.getTextContent());
    String[] newFiles = mixedContent2.getFilePaths();
    String[] changedFiles = changedContents.getFilePaths();
    for (int i = 0; i < newFiles.length; i++) {
      assertEquals(newFiles[i], changedFiles[i]);
    }

    postingService.removePosting("first_blog", 1);
  }
  @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);
  }