Kuzhali,
hasItems is easy to confuse. Here's the documentation:
"Creates a matcher for Iterables that matches when consecutive passes over the examined Iterable yield at least one item that is equal to the corresponding item from the specified items."
So hasItems(id2, id3) is satisfied when any items satisfy equalTo(id2), and any items satisfy equalTo(id3).
not(hasItems(id1, id2)) is satisfied when hasItems(id1, id2) is not satisfied.
Remember, hasItems(id1, id2) is satisfied when any items satisfy equalTo(id1), and any items satisfy equalTo(id2).
You say id2 is present. So there must be nothing satisfying equalTo(id1).
Hope this helps.