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;
}
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"));
}