@Override
 protected void tearDown() throws Exception {
   super.tearDown();
   DefaultDialogData.getInstance().removeConversation(mConversation.getId());
   assertEquals(
       "Not reset", mConversationCount, DefaultDialogData.getInstance().getConversations().size());
   System.setProperty("dexmaker.dexcache", mOldProperty);
 }
  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 testSetup() {
   assertNotNull(
       "Not setup correctly",
       DefaultDialogData.getInstance().getConversation(mConversation.getId()));
   assertEquals("Not setup correctly", 0, mConversation.getMessageCount());
   assertNotNull(mMessageList);
   assertNotNull(mMessageContent);
   assertNotNull(mSendButton);
 }
  public void testChangeInConversationNotifyAdapter() {
    DataSetObserver observer = Mockito.mock(DataSetObserver.class);

    Adapter adapter = mMessageList.getAdapter();
    adapter.registerDataSetObserver(observer);

    mActivity.onConversationChanged(mConversation.getId());

    Mockito.verify(observer, Mockito.times(1)).onChanged();
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    mConversationCount = DefaultDialogData.getInstance().getConversations().size();

    mInstrumentation = getInstrumentation();

    hackMockito();
    mockContact();

    mConversation = DefaultDialogData.getInstance().createOrGetConversation(mContact);

    Intent intent = new Intent(getInstrumentation().getTargetContext(), ConversationActivity.class);
    intent.putExtra(DialogueConversation.CONVERSATION_ID, mConversation.getId());

    startActivity(intent, null, null);
    mActivity = getActivity();

    mMessageList = (ListView) mActivity.findViewById(R.id.message_List);
    mMessageContent = (EditText) mActivity.findViewById(R.id.new_message_content);
    mSendButton = (Button) mActivity.findViewById(R.id.send_message_button);
  }