public void testSetAnchorEventsAreFired() {
populate(alternate);
ObservableConversation.AnchorListener listener =
mock(ObservableConversation.AnchorListener.class);
target.addListener(listener);
Anchor anchor1 = alternate.createAnchor(getFirstBlip(alternate));
// Set anchor from null.
target.setAnchor(anchor1);
verify(listener).onAnchorChanged(null, anchor1);
// Change anchor to different blip.
Anchor anchor11 = alternate.createAnchor(alternate.getRootThread().getFirstBlip()
.getReplyThreads().iterator().next().getFirstBlip());
target.setAnchor(anchor11);
verify(listener).onAnchorChanged(anchor1, anchor11);
// Change anchor to different wavelet.
ObservableConversation alternate2 = makeConversation();
populate(alternate2);
Anchor anchor2 = alternate2.createAnchor(getFirstBlip(alternate2));
target.setAnchor(anchor2);
verify(listener).onAnchorChanged(anchor11, anchor2);
// Set anchor to null.
target.setAnchor(null);