Search in sources :

Example 1 with GistStore

use of com.github.pockethub.android.core.gist.GistStore in project PocketHub by pockethub.

the class PocketHubModule method gistStore.

@Provides
GistStore gistStore(Context context) {
    GistStore store = gists != null ? gists.get() : null;
    if (store == null) {
        store = new GistStore(context);
        gists = new WeakReference<>(store);
    }
    return store;
}
Also used : GistStore(com.github.pockethub.android.core.gist.GistStore) Provides(com.google.inject.Provides)

Example 2 with GistStore

use of com.github.pockethub.android.core.gist.GistStore in project PocketHub by pockethub.

the class GistStoreTest method testReuseIssue.

/**
     * Verify issue is updated when re-added
     */
public void testReuseIssue() {
    GistStore store = new GistStore(mContext);
    assertNull(store.getGist("abcd"));
    Gist gist = Gist.builder().id("abcd").description("description").build();
    // The gist is added and the store will return the given gist
    assertEquals(gist, store.addGist(gist));
    assertEquals(gist, store.getGist("abcd"));
    Gist gist2 = Gist.builder().id("abcd").description("description2").build();
    // The gist has now been updated and should not return the same gist
    assertNotEqual(gist, store.addGist(gist2));
    assertNotEqual(gist.description(), gist2.description());
    assertNotEqual(gist, store.getGist("abcd"));
}
Also used : GistStore(com.github.pockethub.android.core.gist.GistStore) Gist(com.meisolsson.githubsdk.model.Gist)

Aggregations

GistStore (com.github.pockethub.android.core.gist.GistStore)2 Provides (com.google.inject.Provides)1 Gist (com.meisolsson.githubsdk.model.Gist)1