public void testEmptyConversationIsNotAnchored() { assertFalse(target.hasAnchor()); }
public void testEmptyConversationIsNotAnchored() { assertFalse(target.hasAnchor()); }
/** * Checks that the set of all reply threads of a blip is the same as the union * of the inline reply and non-inline reply threads. */ private static void assertThreadChildrenConsistent(ConversationBlip blip) { Set<ConversationThread> allChildren = new HashSet<ConversationThread>(); for (ConversationThread thread : blip.getReplyThreads()) { assertFalse(allChildren.contains(thread)); allChildren.add(thread); } for (ConversationThread child : blip.getReplyThreads()) { assertTrue(allChildren.contains(child)); allChildren.remove(child); } // make sure they are exactly equals assertEquals(0, allChildren.size()); }
/** * Checks that the set of all reply threads of a blip is the same as the union * of the inline reply and non-inline reply threads. */ private static void assertThreadChildrenConsistent(ConversationBlip blip) { Set<ConversationThread> allChildren = new HashSet<ConversationThread>(); for (ConversationThread thread : blip.getReplyThreads()) { assertFalse(allChildren.contains(thread)); allChildren.add(thread); } for (ConversationThread child : blip.getReplyThreads()) { assertTrue(allChildren.contains(child)); allChildren.remove(child); } // make sure they are exactly equals assertEquals(0, allChildren.size()); }
public void testDeleteEmptyThread() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread replyThread = blip.addReplyThread(); replyThread.delete(); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertThreadChildrenConsistent(blip); assertThreadInvalid(replyThread); }
public void testDeleteEmptyThread() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread replyThread = blip.addReplyThread(); replyThread.delete(); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertThreadChildrenConsistent(blip); assertThreadInvalid(replyThread); }
public void testDeleteLastBlipInNonRootThreadDeletesThread() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread replyThread = blip.addReplyThread(); ConversationBlip replyBlip = replyThread.appendBlip(); replyBlip.delete(); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertThreadChildrenConsistent(blip); assertThreadInvalid(replyThread); }
public void testDeleteLastBlipInNonRootThreadDeletesThread() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread replyThread = blip.addReplyThread(); ConversationBlip replyBlip = replyThread.appendBlip(); replyBlip.delete(); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertThreadChildrenConsistent(blip); assertThreadInvalid(replyThread); }
public void testDeleteNonRootThreadRemovesAllBlipsAndThread() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread replyThread = blip.addReplyThread(); ConversationBlip replyBlip1 = replyThread.appendBlip(); ConversationBlip replyBlip2 = replyThread.appendBlip(); replyThread.delete(); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertThreadChildrenConsistent(blip); assertBlipInvalid(replyBlip1); assertBlipInvalid(replyBlip2); assertThreadInvalid(replyThread); }
public void testAnchorToSelfFails() { populate(target); ConversationBlip blip = getFirstBlip(target); Anchor anchor = target.createAnchor(blip); try { target.setAnchor(anchor); fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException expected) { } assertFalse(target.hasAnchor()); }
public void testDeleteNonRootThreadRemovesAllBlipsAndThread() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread replyThread = blip.addReplyThread(); ConversationBlip replyBlip1 = replyThread.appendBlip(); ConversationBlip replyBlip2 = replyThread.appendBlip(); replyThread.delete(); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertThreadChildrenConsistent(blip); assertBlipInvalid(replyBlip1); assertBlipInvalid(replyBlip2); assertThreadInvalid(replyThread); }
public void testClearAnchor() { populate(alternate); ConversationBlip blip = getFirstBlip(alternate); Anchor anchor = alternate.createAnchor(blip); target.setAnchor(anchor); target.setAnchor(null); assertFalse(target.hasAnchor()); }
public void testClearAnchor() { populate(alternate); ConversationBlip blip = getFirstBlip(alternate); Anchor anchor = alternate.createAnchor(blip); target.setAnchor(anchor); target.setAnchor(null); assertFalse(target.hasAnchor()); }
public void testAnchorToSelfFails() { populate(target); ConversationBlip blip = getFirstBlip(target); Anchor anchor = target.createAnchor(blip); try { target.setAnchor(anchor); fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException expected) { } assertFalse(target.hasAnchor()); }
/** * Tests that methods which access the state of a thread without changing it * are correct after thread deletion. */ public void testThreadCanBeAccessedAfterDeletion() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread thread = blip.addReplyThread(); ConversationBlip replyBlip = thread.appendBlip(); thread.delete(); assertBlipInvalid(replyBlip); assertBlipAccessible(replyBlip); assertThreadInvalid(thread); assertThreadAccessible(thread); assertEquals(blip, thread.getParentBlip()); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertEquals(thread, replyBlip.getThread()); assertEquals(Collections.emptyList(), getBlipList(thread)); }
/** * Tests that methods which access the state of a thread without changing it * are correct after thread deletion. */ public void testThreadCanBeAccessedAfterDeletion() { ConversationBlip blip = target.getRootThread().appendBlip(); ConversationThread thread = blip.addReplyThread(); ConversationBlip replyBlip = thread.appendBlip(); thread.delete(); assertBlipInvalid(replyBlip); assertBlipAccessible(replyBlip); assertThreadInvalid(thread); assertThreadAccessible(thread); assertEquals(blip, thread.getParentBlip()); assertFalse(blip.getReplyThreads().iterator().hasNext()); assertEquals(thread, replyBlip.getThread()); assertEquals(Collections.emptyList(), getBlipList(thread)); }