public void testCaseInstanceId() {
// create new task
task = taskService.newTask();
taskService.saveTask(task);
UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_UPDATE);
assertEquals(0, query.count());
// set case instance id and save task
task.setCaseInstanceId("aCaseInstanceId");
taskService.saveTask(task);
assertEquals(1, query.count());
UserOperationLogEntry entry = query.singleResult();
assertNotNull(entry);
assertNull(entry.getOrgValue());
assertEquals("aCaseInstanceId", entry.getNewValue());
assertEquals(CASE_INSTANCE_ID, entry.getProperty());
// change case instance id and save task
task.setCaseInstanceId("anotherCaseInstanceId");
taskService.saveTask(task);
assertEquals(2, query.count());
List<UserOperationLogEntry> entries = query.list();
assertEquals(2, entries.size());
for (UserOperationLogEntry currentEntry : entries) {
if (!currentEntry.getId().equals(entry.getId())) {
assertEquals("aCaseInstanceId", currentEntry.getOrgValue());