public void testRestoreFromBundleTooManyConversationId() {
    Bundle bundle = new Bundle();

    ArrayList<Conversation> conversations = new ArrayList<Conversation>(TWELVE);
    ArrayList<ConversationId> conversationIds = new ArrayList<ConversationId>(TWELVE + 1);

    bundle.putParcelableArrayList(CONVERSATION_ID, conversationIds);
    bundle.putParcelableArrayList(CONVERSATION, conversations);

    mDialogueData.restoreFromBundle(bundle);

    // nothing should happen
  }
  public void testDeleteAll() {
    Contact contact1 = Mockito.mock(Contact.class);
    Contact contact2 = Mockito.mock(Contact.class);

    mDialogueData.createOrGetConversation(contact1);
    mDialogueData.createOrGetConversation(contact2);

    assertFalse(0 == mDialogueData.getConversations().size());

    mDialogueData.removeAllConversations();

    assertTrue(0 == mDialogueData.getConversations().size());
  }
 public void testRestoreFromNullBundle() {
   try {
     mDialogueData.restoreFromBundle(null);
     fail("NullArgumentException expected");
   } catch (NullArgumentException e) {
     // all good :)
   }
 }
 public void testRemoveNullListener() {
   try {
     mDialogueData.removeListener(null);
     fail("NullArgumentException expected");
   } catch (NullArgumentException e) {
     // all good :)
   }
 }
 public void testAddNullMessageToConversation() {
   try {
     mDialogueData.addMessageToConversation(null);
     fail("NullArgumentException expected");
   } catch (NullArgumentException e) {
     // all good :)
   }
 }
 public void testGetNullConversation() {
   try {
     mDialogueData.getConversation(null);
     fail("NullArgumentException expected");
   } catch (NullArgumentException e) {
     // all good :)
   }
 }
  public void testUpdateConversation() {
    Contact contact1 = Mockito.mock(Contact.class);

    Conversation conversationBefore = mDialogueData.createOrGetConversation(contact1);
    assertNull(conversationBefore.getChannel());

    conversationBefore.setChannel(ChannelType.SMS);

    mDialogueData.updateConversation(conversationBefore);

    Conversation conversationAfter = mDialogueData.createOrGetConversation(contact1);
    assertNotNull(conversationAfter.getChannel());
    assertEquals(ChannelType.SMS, conversationAfter.getChannel());

    mDialogueData.removeConversation(conversationBefore.getId());
    mDialogueData.removeConversation(conversationAfter.getId());
  }
 public void testUpdateConversationNull() {
   try {
     mDialogueData.updateConversation(null);
     fail();
   } catch (NullArgumentException e) {
     // OK
   }
 }
  public void testRestoreFromBundleNullConversationId() {
    Bundle bundle = new Bundle();

    bundle.putParcelableArrayList(CONVERSATION_ID, null);

    mDialogueData.restoreFromBundle(bundle);

    // nothing should happen
  }
  public void testRemoveNonAddedListener() {
    mDialogueData.removeListener(
        new DialogueDataListener() {
          @Override
          public void onDialogueDataChanged() {
            // we don't care :)
          }
        });

    // nothing should happen :)
  }