Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20e2e9c1 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add unit test for PhoneAccount equality operator.

Test: Add unit test for PhoneAccount equality.
Bug: 112884689
Change-Id: I7409392f7ecac9697b5355d442d84cebadd8228e
parent 12ea9653
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -882,6 +882,33 @@ public class PhoneAccountRegistrarTest extends TelecomTestCase {
                PhoneAccount.CAPABILITY_RTT);
    }

    /**
     * Tests {@link PhoneAccount#equals(Object)} operator.
     * @throws Exception
     */
    @MediumTest
    @Test
    public void testPhoneAccountEquality() throws Exception {
        PhoneAccountHandle handle = new PhoneAccountHandle(new ComponentName("foo", "bar"), "id");
        PhoneAccount.Builder builder = new PhoneAccount.Builder(handle, "label");
        builder.addSupportedUriScheme("tel");
        builder.setAddress(Uri.fromParts("tel", "6505551212", null));
        builder.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER);
        Bundle extras = new Bundle();
        extras.putInt("INT", 1);
        extras.putString("STR", "str");
        builder.setExtras(extras);
        builder.setGroupId("group");
        builder.setHighlightColor(1);
        builder.setShortDescription("short");
        builder.setSubscriptionAddress(Uri.fromParts("tel", "6505551213", null));
        builder.setSupportedAudioRoutes(2);

        PhoneAccount account1 = builder.build();
        PhoneAccount account2 = builder.build();
        assertEquals(account1, account2);
    }

    private static ComponentName makeQuickConnectionServiceComponentName() {
        return new ComponentName(
                "com.android.server.telecom.tests",