public void testContentDaoTriageStatus() throws Exception {
    User user = getUser(userDao, "testuser");
    CollectionItem root = (CollectionItem) contentDao.getRootItem(user);

    ContentItem item = generateTestContent();
    item.setName("test");
    TriageStatus initialTriageStatus = new HibTriageStatus();
    TriageStatusUtil.initialize(initialTriageStatus);
    item.setTriageStatus(initialTriageStatus);

    ContentItem newItem = contentDao.createContent(root, item);

    Assert.assertTrue(getHibItem(newItem).getId() > -1);
    Assert.assertTrue(newItem.getUid() != null);

    clearSession();

    ContentItem queryItem = contentDao.findContentByUid(newItem.getUid());
    TriageStatus triageStatus = queryItem.getTriageStatus();
    Assert.assertEquals(initialTriageStatus, triageStatus);

    triageStatus.setCode(TriageStatus.CODE_LATER);
    triageStatus.setAutoTriage(false);
    BigDecimal rank = new BigDecimal("-98765.43");
    triageStatus.setRank(rank);

    contentDao.updateContent(queryItem);
    clearSession();

    queryItem = contentDao.findContentByUid(newItem.getUid());
    triageStatus = queryItem.getTriageStatus();
    Assert.assertEquals(triageStatus.getAutoTriage(), Boolean.FALSE);
    Assert.assertEquals(triageStatus.getCode(), new Integer(TriageStatus.CODE_LATER));
    Assert.assertEquals(triageStatus.getRank(), rank);

    queryItem.setTriageStatus(null);
    contentDao.updateContent(queryItem);
    clearSession();
    // should be null triagestatus
    queryItem = contentDao.findContentByUid(newItem.getUid());
    triageStatus = queryItem.getTriageStatus();
    Assert.assertNull(triageStatus);
  }
  private NoteItem createChild(CollectionItem collection) {
    NoteItem item = entityFactory.createNote();

    // let the storage layer assign a uid to the item

    item.setOwner(collection.getOwner());
    item.getParents().add(collection);
    collection.getChildren().add(item);

    item.setClientCreationDate(java.util.Calendar.getInstance().getTime());
    item.setClientModifiedDate(item.getClientCreationDate());
    item.setTriageStatus(TriageStatusUtil.initialize(entityFactory.createTriageStatus()));
    item.setLastModifiedBy(item.getOwner().getUsername());
    item.setLastModification(ContentItem.Action.CREATED);
    item.setSent(Boolean.FALSE);
    item.setNeedsReply(Boolean.FALSE);

    return item;
  }