LastfmClient { public boolean isAuthenticated() { return session != null; } LastfmClient(LastfmApi api, Caller caller, String userAgent, String sessionKey);  LastfmClient(LastfmApi api, Caller caller, String userAgent); boolean isAuthenticated(); Uri getAuthUrl(); void getSession(String token, Handler.Callback callback); void updateNowPlaying(com.peterjosling.scroball.Track track, Handler.Callback callback); void scrobbleTracks(List<Scrobble> scrobbles, Handler.Callback callback); void getTrackInfo(com.peterjosling.scroball.Track track, Handler.Callback callback); void loveTrack(com.peterjosling.scroball.Track track, Handler.Callback callback); void clearSession(); static boolean isTransientError(int errorCode); static boolean isAuthenticationError(int errorCode); static final int ERROR_NO_ERROR; static final int ERROR_UNKNOWN; static final int ERROR_OPERATION_FAILED; static final int ERROR_INVALID_SESSION; static final int ERROR_SERVICE_OFFLINE; static final int ERROR_UNAUTHORIZED_TOKEN; static final int ERROR_SERVICE_TEMPORARILY_UNAVAILABLE; static final ImmutableSet<Integer> TRANSIENT_ERROR_CODES; }
@Test public void isAuthenticated_falseWhenNoSession() { LastfmClient client = new LastfmClient(lastfmApi, caller, "test"); assertThat(client.isAuthenticated()).isFalse(); }
@Test public void isAuthenticated_trueWhenCreatedWithSessionKey() { client = new LastfmClient(lastfmApi, caller, "test", "testkey"); assertThat(client.isAuthenticated()).isTrue(); }