use of com.microsoft.identity.common.internal.cache.ICacheKeyValueDelegate in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalOAuth2TokenCacheTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
mockStrategy = Mockito.mock(MicrosoftStsOAuth2Strategy.class);
mockRequest = Mockito.mock(MicrosoftStsAuthorizationRequest.class);
mockResponse = Mockito.mock(MicrosoftStsTokenResponse.class);
mockCredentialAdapter = Mockito.mock(IAccountCredentialAdapter.class);
// Used by mocks
defaultTestBundleV1 = new AccountCredentialTestBundle(MicrosoftAccount.AUTHORITY_TYPE_V1_V2, LOCAL_ACCOUNT_ID, USERNAME, HOME_ACCOUNT_ID, ENVIRONMENT, REALM, TARGET, CACHED_AT, EXPIRES_ON, SECRET, CLIENT_ID, SECRET, MOCK_ID_TOKEN_WITH_CLAIMS, null, SESSION_KEY, V1IdToken);
defaultTestBundleV2 = new AccountCredentialTestBundle(MicrosoftAccount.AUTHORITY_TYPE_V1_V2, LOCAL_ACCOUNT_ID, USERNAME, HOME_ACCOUNT_ID, ENVIRONMENT, REALM, TARGET, CACHED_AT, EXPIRES_ON, SECRET, CLIENT_ID, SECRET, MOCK_ID_TOKEN_WITH_CLAIMS, null, SESSION_KEY, IdToken);
// Mocks
configureMocksForTestBundle(defaultTestBundleV2);
// Context and related init
final Context context = InstrumentationRegistry.getTargetContext();
mSharedPreferencesFileManager = SharedPreferencesFileManager.getSharedPreferences(context, "test_prefs", new StorageHelper(context));
final ICacheKeyValueDelegate keyValueDelegate = new CacheKeyValueDelegate();
accountCredentialCache = new SharedPreferencesAccountCredentialCache(keyValueDelegate, mSharedPreferencesFileManager);
mOauth2TokenCache = new MsalOAuth2TokenCache<>(context, accountCredentialCache, mockCredentialAdapter);
}
Aggregations