Search in sources :

Example 1 with IssueStore

use of com.github.pockethub.android.core.issue.IssueStore in project PocketHub by pockethub.

the class IssueStoreTest method testReuseIssue.

/**
     * Verify issue is updated when re-added
     */
public void testReuseIssue() {
    IssueStore store = new IssueStore(mContext);
    Repository repo = InfoUtils.createRepoFromData("owner", "name");
    assertNull(store.getIssue(repo, 1));
    Issue issue = Issue.builder().repository(repo).number(1).body("body").build();
    assertEquals(issue, store.addIssue(issue));
    assertEquals(issue, store.getIssue(repo, 1));
    Issue issue2 = Issue.builder().repository(repo).number(1).body("body2").build();
    assertNotEqual(issue, store.addIssue(issue2));
    assertNotEqual(issue2.body(), issue.body());
    assertNotEqual(issue, store.getIssue(repo, 1));
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) Issue(com.meisolsson.githubsdk.model.Issue) IssueStore(com.github.pockethub.android.core.issue.IssueStore)

Example 2 with IssueStore

use of com.github.pockethub.android.core.issue.IssueStore in project PocketHub by pockethub.

the class PocketHubModule method issueStore.

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

Aggregations

IssueStore (com.github.pockethub.android.core.issue.IssueStore)2 Provides (com.google.inject.Provides)1 Issue (com.meisolsson.githubsdk.model.Issue)1 Repository (com.meisolsson.githubsdk.model.Repository)1