diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java | 10 | ||||
-rw-r--r-- | tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java | 5 | ||||
-rw-r--r-- | tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java (renamed from tests/src/com/android/dialer/calllog/TestPhoneNumberHelper.java) | 17 |
3 files changed, 17 insertions, 15 deletions
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index 05c59a77f..6a9817f26 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -26,8 +26,7 @@ import android.view.View; import android.widget.TextView; import com.android.dialer.calllog.CallTypeHelper; -import com.android.dialer.calllog.PhoneNumberHelper; -import com.android.dialer.calllog.TestPhoneNumberHelper; +import com.android.dialer.calllog.TestPhoneNumberUtilsWrapper; import com.android.dialer.util.LocaleTestUtils; import java.util.GregorianCalendar; @@ -58,7 +57,6 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { /** The views to fill. */ private PhoneCallDetailsViews mViews; private TextView mNameView; - private PhoneNumberHelper mPhoneNumberHelper; private LocaleTestUtils mLocaleTestUtils; @Override @@ -67,8 +65,9 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { Context context = getContext(); Resources resources = context.getResources(); CallTypeHelper callTypeHelper = new CallTypeHelper(resources); - mPhoneNumberHelper = new TestPhoneNumberHelper(resources, TEST_VOICEMAIL_NUMBER); - mHelper = new PhoneCallDetailsHelper(resources, callTypeHelper, mPhoneNumberHelper); + final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper( + TEST_VOICEMAIL_NUMBER); + mHelper = new PhoneCallDetailsHelper(resources, callTypeHelper, phoneUtils); mHelper.setCurrentTimeForTest( new GregorianCalendar(2011, 5, 4, 13, 0, 0).getTimeInMillis()); mViews = PhoneCallDetailsViews.createForTest(context); @@ -83,7 +82,6 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mNameView = null; mViews = null; mHelper = null; - mPhoneNumberHelper = null; super.tearDown(); } diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index 1b793bc65..bb940edca 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -57,9 +57,10 @@ public class CallLogListItemHelperTest extends AndroidTestCase { Context context = getContext(); Resources resources = context.getResources(); CallTypeHelper callTypeHelper = new CallTypeHelper(resources); - mPhoneNumberHelper = new TestPhoneNumberHelper(resources, TEST_VOICEMAIL_NUMBER); + final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper( + TEST_VOICEMAIL_NUMBER); PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper( - resources, callTypeHelper, mPhoneNumberHelper); + resources, callTypeHelper, phoneUtils); mHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberHelper, resources); mViews = CallLogListItemViews.createForTest(context); } diff --git a/tests/src/com/android/dialer/calllog/TestPhoneNumberHelper.java b/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java index 2671a7151..0dbd91479 100644 --- a/tests/src/com/android/dialer/calllog/TestPhoneNumberHelper.java +++ b/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License */ package com.android.dialer.calllog; @@ -19,15 +19,18 @@ package com.android.dialer.calllog; import android.content.res.Resources; /** - * Modified version of {@link PhoneNumberHelper} to be used in tests that allows injecting the - * voicemail number. + * Modified version of {@link com.android.dialer.calllog.PhoneNumberHelper} to be used in tests + * that allows injecting the voicemail number. */ -public final class TestPhoneNumberHelper extends PhoneNumberHelper { +public final class TestPhoneNumberUtilsWrapper extends PhoneNumberUtilsWrapper { private CharSequence mVoicemailNumber; - public TestPhoneNumberHelper(Resources resources, CharSequence voicemailNumber) { - super(resources); + public TestPhoneNumberUtilsWrapper(CharSequence voicemailNumber) { mVoicemailNumber = voicemailNumber; } + @Override + public boolean isVoicemailNumber(CharSequence number) { + return mVoicemailNumber.equals(number); + } } |