use of android.accounts.Account in project robolectric by robolectric.
the class ShadowAccountTest method shouldHaveParcelConstructor.
@Test
public void shouldHaveParcelConstructor() throws Exception {
Account expected = new Account("name", "type");
Parcel p = Parcel.obtain();
expected.writeToParcel(p, 0);
p.setDataPosition(0);
Account actual = new Account(p);
assertThat(actual).isEqualTo(expected);
}
use of android.accounts.Account in project robolectric by robolectric.
the class ShadowAccountTest method shouldHaveToString.
@Test
public void shouldHaveToString() throws Exception {
Account account = new Account("name", "type");
assertThat(account.toString()).isEqualTo("Account {name=name, type=type}");
}
use of android.accounts.Account in project robolectric by robolectric.
the class ShadowAccountTest method shouldBeParcelable.
@Test
public void shouldBeParcelable() throws Exception {
Account expected = new Account("name", "type");
Parcel p = Parcel.obtain();
expected.writeToParcel(p, 0);
p.setDataPosition(0);
Account actual = Account.CREATOR.createFromParcel(p);
assertThat(actual).isEqualTo(expected);
}
use of android.accounts.Account in project robolectric by robolectric.
the class ShadowAccountTest method shouldHaveStringsConstructor.
@Test
public void shouldHaveStringsConstructor() throws Exception {
Account account = new Account("name", "type");
assertThat(account.name).isEqualTo("name");
assertThat(account.type).isEqualTo("type");
}
use of android.accounts.Account in project robolectric by robolectric.
the class ShadowAccountManagerTest method whenPaused_getAuthToken.
@Test
public void whenPaused_getAuthToken() throws Exception {
scheduler.pause();
Account account = new Account("name", "google.com");
shadowOf(am).addAccount(account);
shadowOf(am).addAuthenticator("google.com");
am.setAuthToken(account, "auth_token_type", "token1");
TestAccountManagerCallback<Bundle> callback = new TestAccountManagerCallback<>();
AccountManagerFuture<Bundle> future = am.getAuthToken(account, "auth_token_type", new Bundle(), activity, callback, new Handler());
assertThat(future.isDone()).isFalse();
assertThat(callback.hasBeenCalled()).isFalse();
scheduler.unPause();
assertThat(future.isDone()).isTrue();
assertThat(callback.hasBeenCalled()).isTrue();
}
Aggregations