public void testAuditHistory() throws Exception {
NodeImpl rootNode = (NodeImpl) session.getRootNode().getNode(ROOT_PATH);
// Should not be autocreated
ExtendedNode node = (ExtendedNode) rootNode.addNode("deep", "nt:unstructured");
// node.addMixin("exo:auditable");
String auditHistoryUUID = node.getProperty("exo:auditHistory").getString();
Node auditHistory = session.getNodeByUUID(auditHistoryUUID);
// under audit
node.setProperty("test", "testValue");
assertTrue(auditHistory.isNodeType("exo:auditHistory"));
node.getProperty("test").remove();
session.save();
assertTrue(service.hasHistory(node));
assertFalse(service.hasHistory(session.getRootNode()));
AuditHistory history = service.getHistory(node);
assertTrue(node.isSame(history.getAuditableNode()));
assertEquals(3, history.getAuditRecords().size());
assertEquals(Event.PROPERTY_ADDED, history.getAuditRecords().get(1).getEventType());
assertEquals(ExtendedEventType.PROPERTY_ADDED, history.getAuditRecords()
.get(1)