@Override
    public void updateAdd(Object key, Object value) {
        int keyHash = key.hashCode();
        int valueHash = value.hashCode();

        int leafOrder = MerkleTreeUtil.getLeafOrderForHash(keyHash, leafLevel);
        int leafCurrentHash = getNodeHash(leafOrder);
        int leafNewHash = MerkleTreeUtil.addHash(leafCurrentHash, valueHash);

        setNodeHash(leafOrder, leafNewHash);
        updateBranch(leafOrder);
    }
@Test
    public void testUpdateAdd() {
        MerkleTree merkleTree = new ArrayMerkleTree(3);

        merkleTree.updateAdd(1, 1);
        merkleTree.updateAdd(2, 2);
        merkleTree.updateAdd(3, 3);

        int expectedHash = 0;
        expectedHash = MerkleTreeUtil.addHash(expectedHash, 1);
        expectedHash = MerkleTreeUtil.addHash(expectedHash, 2);
        expectedHash = MerkleTreeUtil.addHash(expectedHash, 3);

        int nodeHash = merkleTree.getNodeHash(5);

        assertEquals(expectedHash, nodeHash);
    }