@Test public void testInit() throws Exception { credentialStore.init(accessToken, refreshToken, expiresIn, acquisitionTime, CredentialStore.AUTHENTICATED); assertEquals(credentialStore.getAccessToken(), accessToken); assertEquals(credentialStore.getRefreshToken(), refreshToken); assertEquals(credentialStore.getExpiresIn(), expiresIn); assertEquals(credentialStore.getTokenAcquisitionTime(), acquisitionTime); assertEquals(credentialStore.getAuthStatus(), CredentialStore.AUTHENTICATED); try { credentialStore.init(null, refreshToken, expiresIn, acquisitionTime, CredentialStore.AUTHENTICATED); assertTrue(false); } catch (Exception ignored) { } credentialStore.init(null, refreshToken, expiresIn, acquisitionTime, CredentialStore.NOT_AUTHENTICATED); }
public void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus) { if((accessToken == null || refreshToken == null || tokenAcquisitionTime == null) && authStatus != NOT_AUTHENTICATED) throw new IllegalArgumentException("(accessToken == null || refreshToken == null || tokenAcquireTime == null) && authStatus != NOT_AUTHENTICATED"); this.accessToken = accessToken; this.refreshToken = refreshToken; this.expiresIn = expiresIn; this.tokenAcquisitionTime = tokenAcquisitionTime; this.authStatus = authStatus; }
CredentialStore { public void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus) { if((accessToken == null || refreshToken == null || tokenAcquisitionTime == null) && authStatus != NOT_AUTHENTICATED) throw new IllegalArgumentException("(accessToken == null || refreshToken == null || tokenAcquireTime == null) && authStatus != NOT_AUTHENTICATED"); this.accessToken = accessToken; this.refreshToken = refreshToken; this.expiresIn = expiresIn; this.tokenAcquisitionTime = tokenAcquisitionTime; this.authStatus = authStatus; } }
CredentialStore { public void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus) { if((accessToken == null || refreshToken == null || tokenAcquisitionTime == null) && authStatus != NOT_AUTHENTICATED) throw new IllegalArgumentException("(accessToken == null || refreshToken == null || tokenAcquireTime == null) && authStatus != NOT_AUTHENTICATED"); this.accessToken = accessToken; this.refreshToken = refreshToken; this.expiresIn = expiresIn; this.tokenAcquisitionTime = tokenAcquisitionTime; this.authStatus = authStatus; } CredentialStore(CredentialPersister persister); }
CredentialStore { public void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus) { if((accessToken == null || refreshToken == null || tokenAcquisitionTime == null) && authStatus != NOT_AUTHENTICATED) throw new IllegalArgumentException("(accessToken == null || refreshToken == null || tokenAcquireTime == null) && authStatus != NOT_AUTHENTICATED"); this.accessToken = accessToken; this.refreshToken = refreshToken; this.expiresIn = expiresIn; this.tokenAcquisitionTime = tokenAcquisitionTime; this.authStatus = authStatus; } CredentialStore(CredentialPersister persister); void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus); String getAccessToken(); String getRefreshToken(); int getExpiresIn(); Date getTokenAcquisitionTime(); }
CredentialStore { public void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus) { if((accessToken == null || refreshToken == null || tokenAcquisitionTime == null) && authStatus != NOT_AUTHENTICATED) throw new IllegalArgumentException("(accessToken == null || refreshToken == null || tokenAcquireTime == null) && authStatus != NOT_AUTHENTICATED"); this.accessToken = accessToken; this.refreshToken = refreshToken; this.expiresIn = expiresIn; this.tokenAcquisitionTime = tokenAcquisitionTime; this.authStatus = authStatus; } CredentialStore(CredentialPersister persister); void init(String accessToken, String refreshToken, int expiresIn, Date tokenAcquisitionTime, @AuthStatus int authStatus); String getAccessToken(); String getRefreshToken(); int getExpiresIn(); Date getTokenAcquisitionTime(); final static int NOT_AUTHENTICATED; final static int TOKEN_EXPIRED; final static int AUTHENTICATED; }