public void testDeltaMerger() {
final ViewDeltaResultModelMerger merger = new ViewDeltaResultModelMerger();
assertNull(merger.getLatestResult());
final InMemoryViewDeltaResultModel deltaResult1 = new InMemoryViewDeltaResultModel();
deltaResult1.addValue(CONFIG_1, getComputedValueResult("value1", 1));
deltaResult1.addValue(CONFIG_1, getComputedValueResult("value2", 2));
merger.merge(deltaResult1);
assertResultsEqual(deltaResult1, merger.getLatestResult());
final InMemoryViewDeltaResultModel deltaResult2 = new InMemoryViewDeltaResultModel();
deltaResult2.addValue(CONFIG_1, getComputedValueResult("value1", 3));
merger.merge(deltaResult1);
merger.merge(deltaResult2);
InMemoryViewDeltaResultModel expectedMergedResult = new InMemoryViewDeltaResultModel();
expectedMergedResult.addValue(CONFIG_1, getComputedValueResult("value1", 3));
expectedMergedResult.addValue(CONFIG_1, getComputedValueResult("value2", 2));
assertResultsEqual(expectedMergedResult, merger.getLatestResult());
final InMemoryViewDeltaResultModel deltaResult3 = new InMemoryViewDeltaResultModel();
deltaResult3.addValue(CONFIG_2, getComputedValueResult("value3", 4));
merger.merge(deltaResult1);
merger.merge(deltaResult3);
expectedMergedResult = new InMemoryViewDeltaResultModel();
expectedMergedResult.addValue(CONFIG_1, getComputedValueResult("value1", 1));
expectedMergedResult.addValue(CONFIG_1, getComputedValueResult("value2", 2));
expectedMergedResult.addValue(CONFIG_2, getComputedValueResult("value3", 4));
assertResultsEqual(expectedMergedResult, merger.getLatestResult());