From 638c67f4dbad4055b1d89834ca2e140f55a06d66 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Wed, 14 Jul 2010 17:51:28 -0700 Subject: [PATCH] Adding more test to MessageOrderManager Added a case where all the message in the message list is removed. Change-Id: Iedc2dbdf391978bd67d3bcdc260590d98cc9ef7d --- .../email/activity/MessageOrderManagerTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/src/com/android/email/activity/MessageOrderManagerTest.java b/tests/src/com/android/email/activity/MessageOrderManagerTest.java index dc60c0f99..b36a55b85 100644 --- a/tests/src/com/android/email/activity/MessageOrderManagerTest.java +++ b/tests/src/com/android/email/activity/MessageOrderManagerTest.java @@ -16,7 +16,6 @@ package com.android.email.activity; -import com.android.email.Email; import com.android.email.provider.EmailContent; import com.android.email.provider.EmailProvider; @@ -216,9 +215,19 @@ public class MessageOrderManagerTest extends ProviderTestCase2 { assertEquals(22, mom.getCurrentMessageId()); assertCanMove(mom, false, false); // Can't move either way - // Now the current message is gone... messageNotFound gets called. - mom.updateMessageList(11, 33, 44); + // Delete 22 -- no messages left. + mom.updateMessageList(); + mCallback.assertCallbacksCalled(false, true); + // Test for the case where list is not empty, but the current message is gone. + // First, set up a list with 22 as the current message. + mom.updateMessageList(11, 22, 33, 44); + mom.moveTo(22); + assertEquals(22, mom.getCurrentMessageId()); + mCallback.assertCallbacksCalled(true, false); + + // Then remove the current message. + mom.updateMessageList(11, 33, 44); mCallback.assertCallbacksCalled(false, true); }