public void testChangeInConversationIllegalId() { assertEquals(mMessageList.getAdapter().getCount(), mConversation.getMessageCount()); try { mActivity.onConversationChanged(IdManager.getInstance().newConversationId()); fail("Exception should have been thrown"); } catch (IllegalArgumentException e) { } }
public void testChangeInConversationNull() { assertEquals(mMessageList.getAdapter().getCount(), mConversation.getMessageCount()); try { mActivity.onConversationChanged(null); fail("Exception should have been thrown"); } catch (NullArgumentException e) { } }
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); }
public void testSendButtonText() { assertEquals( mSendButton.getText().toString(), mActivity.getString(R.string.send_message_button)); }
public void testActivityTitle() { assertEquals(mActivity.getTitle().toString(), CONTACT_NAME); }