Code example for Account

0
        Robolectric.shadowOf(am).addAccount(a1);
        assertThat(am.getAccounts()).isNotNull();
        assertThat(am.getAccounts().length).isEqualTo(1);
        assertThat(am.getAccounts()[0]).isSameAs(a1);
 
        Account a2 = new Account("name_b", "type_b");
        Robolectric.shadowOf(am).addAccount(a2);
        assertThat(am.getAccounts()).isNotNull();
        assertThat(am.getAccounts().length).isEqualTo(2);
        assertThat(am.getAccounts()[1]).isSameAs(a2);
    } 
 
    @Test 
    public void testGetAccountsByType() { 
        AccountManager am = AccountManager.get(app);
        assertThat(am.getAccountsByType("name_a")).isNotNull();
        assertThat(am.getAccounts().length).isEqualTo(0);
 
        Account a1 = new Account("name_a", "type_a");
        Robolectric.shadowOf(am).addAccount(a1);
        Account[] accounts = am.getAccountsByType("type_a");