/** * Asserts that a new conversation model built on top of the target * conversation's substrate matches the structure of that. */ private void assertMirrorConversationEquivalent() { Conversation copy = mirrorConversation(target); assertThreadsEquivalent(target.getRootThread(), copy.getRootThread()); }
/** * Asserts that a new conversation model built on top of the target * conversation's substrate matches the structure of that. */ private void assertMirrorConversationEquivalent() { Conversation copy = mirrorConversation(target); assertThreadsEquivalent(target.getRootThread(), copy.getRootThread()); }
private static void assertBlipsEquivalent(ConversationBlip expected, ConversationBlip actual) { assertEquals("Mismatched id in constructed conversation blip", expected.getId(), actual.getId()); assertEquals("Mismatched author in constructed conversation blip", expected.getAuthorId(), actual.getAuthorId()); assertEquals("Mismatched timestamp in constructed conversation blip", expected.getLastModifiedTime(), actual.getLastModifiedTime()); assertEquals("Mismatched contributors in constructed conversation blip", expected.getContributorIds(), actual.getContributorIds()); Iterator<? extends ConversationThread> expectedThreads = expected.getReplyThreads().iterator(); Iterator<? extends ConversationThread> actualThreads = actual.getReplyThreads().iterator(); while (expectedThreads.hasNext()) { assertTrue("Missing thread in reconstructed conversation", actualThreads.hasNext()); ConversationThread expectedThread = expectedThreads.next(); ConversationThread actualThread = actualThreads.next(); assertThreadsEquivalent(expectedThread, actualThread); } assertFalse("Extra thread in reconstructed conversation", actualThreads.hasNext()); } }
private static void assertBlipsEquivalent(ConversationBlip expected, ConversationBlip actual) { assertEquals("Mismatched id in constructed conversation blip", expected.getId(), actual.getId()); assertEquals("Mismatched author in constructed conversation blip", expected.getAuthorId(), actual.getAuthorId()); assertEquals("Mismatched timestamp in constructed conversation blip", expected.getLastModifiedTime(), actual.getLastModifiedTime()); assertEquals("Mismatched contributors in constructed conversation blip", expected.getContributorIds(), actual.getContributorIds()); Iterator<? extends ConversationThread> expectedThreads = expected.getReplyThreads().iterator(); Iterator<? extends ConversationThread> actualThreads = actual.getReplyThreads().iterator(); while (expectedThreads.hasNext()) { assertTrue("Missing thread in reconstructed conversation", actualThreads.hasNext()); ConversationThread expectedThread = expectedThreads.next(); ConversationThread actualThread = actualThreads.next(); assertThreadsEquivalent(expectedThread, actualThread); } assertFalse("Extra thread in reconstructed conversation", actualThreads.hasNext()); } }