From bdf60d080ccab765e659b0e27b1fdb7122f5d008 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 3 Jun 2015 18:03:27 -0700 Subject: Fix unit test errors. When this was refactored before, some of the logic was bad. Some of the expected values were changed as well. I figured "add to contacts" is a really bad default text, because we don't actually support that action in call details. Also, the strings returned by the library for describing relative time spans changed. Bug: 21471763 Change-Id: I0c78c89c9c2e44de198f1f9299711fc31fe81cb1 --- .../android/dialer/PhoneCallDetailsHelperTest.java | 25 ++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java') diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index 701a06ed9..3e7eb66b6 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -132,11 +132,11 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { setPhoneCallDetailsWithDate( new GregorianCalendar(2011, 5, 3, 13, 0, 0).getTimeInMillis()); - assertDateEquals("0 mins ago"); + assertDateEquals("0 min. ago"); setPhoneCallDetailsWithDate( new GregorianCalendar(2011, 5, 3, 12, 0, 0).getTimeInMillis()); - assertDateEquals("1 hour ago"); + assertDateEquals("1 hr. ago"); setPhoneCallDetailsWithDate( new GregorianCalendar(2011, 5, 2, 13, 0, 0).getTimeInMillis()); @@ -223,7 +223,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { public void testSetCallDetailsHeader_NumberOnly() { setCallDetailsHeaderWithNumber(TEST_NUMBER, Calls.PRESENTATION_ALLOWED); assertEquals(View.VISIBLE, mNameView.getVisibility()); - assertEquals("Add to contacts", mNameView.getText().toString()); + assertEquals("1-412-255-5555", mNameView.getText().toString()); } public void testSetCallDetailsHeader_UnknownNumber() { @@ -245,7 +245,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } public void testSetCallDetailsHeader_VoicemailNumber() { - setCallDetailsHeaderWithNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED); + setCallDetailsHeaderWithVoicemailNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED); assertEquals(View.VISIBLE, mNameView.getVisibility()); assertEquals("Voicemail", mNameView.getText().toString()); } @@ -412,6 +412,23 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { false /* isVoicemail */)); } + private void setCallDetailsHeaderWithVoicemailNumber(String number, int presentation) { + mHelper.setCallDetailsHeader(mNameView, + new PhoneCallDetails( + mContext, + number, + presentation, + TEST_FORMATTED_NUMBER, + TEST_COUNTRY_ISO, + TEST_GEOCODE, + new int[]{ Calls.INCOMING_TYPE }, + TEST_DATE, + TEST_DURATION, + null, 0, null, null, + true /* isVoicemail */)); + } + + private void setCallDetailsHeader(String name) { mHelper.setCallDetailsHeader(mNameView, new PhoneCallDetails( -- cgit v1.2.3