@Test
public void testGetPreviousOpObject() {

	OpObject originObject = null;
	HistoryManager.HistoryEdit previousHistoryEdit = null;
	HistoryManager.HistoryEdit historyEdit = new HistoryManager.HistoryEdit(
			Arrays.asList("user", "test1"),
			"sys.operation",
			generateTestDeletedDeltaObject(),
			new Date().toString(),
			HistoryManager.Status.DELETED,
			"0x"
	);
	originObject = historyManager.getPreviousOpObject(originObject, previousHistoryEdit, historyEdit);
	previousHistoryEdit = historyEdit;
	assertNotNull(originObject);
	HistoryManager.HistoryEdit firstHistoryEdit = generateHistoryEdit(
			generateTestDeletedDeltaObject(),
			HistoryManager.Status.EDITED,
			null
	);
	firstHistoryEdit.setDeltaChanges(generateObjEdit());
	originObject = historyManager.getPreviousOpObject(originObject, previousHistoryEdit, firstHistoryEdit);
	previousHistoryEdit = firstHistoryEdit;
	assertNull(originObject.getFieldByExpr("lat"));
	assertEquals(originObject.getFieldByExpr("lon"), 12346);
	assertEquals(originObject.getFieldByExpr("addf"), 1234567);
	assertEquals(((List)originObject.getFieldByExpr("tags")).size(), 3);
	HistoryManager.HistoryEdit secondHistoryEdit = generateHistoryEdit(
			generateTestDeletedDeltaObject(),
			HistoryManager.Status.EDITED,
			generateSecondObjEdit()
	);
	secondHistoryEdit.setDeltaChanges(generateSecondObjEdit());
	originObject = historyManager.getPreviousOpObject(originObject, previousHistoryEdit, secondHistoryEdit);
	previousHistoryEdit = secondHistoryEdit;
	assertEquals(originObject.getFieldByExpr("lon"), 12345L);
	assertEquals(originObject.getFieldByExpr("lat"), "222EC");
	assertNull(originObject.getFieldByExpr("addf"));
	assertEquals(((List)originObject.getFieldByExpr("tags")).size(), 2);
	HistoryManager.HistoryEdit createHistoryEdit = generateHistoryEdit(
			null,
			HistoryManager.Status.CREATED,
			null
	);
	originObject = historyManager.getPreviousOpObject(originObject, previousHistoryEdit, createHistoryEdit);
	assertEquals(originObject.getFieldByExpr("lon"), 12344L);
	assertEquals(originObject.getFieldByExpr("lat"), "222EC");
	assertEquals(originObject.getFieldByExpr("det"), "111EC");
	assertEquals(((List)originObject.getFieldByExpr("tags")).size(), 1);
}