Search in sources :

Example 1 with FullCommit

use of com.github.pockethub.android.core.commit.FullCommit in project PocketHub by pockethub.

the class FullCommitTest method testSingleCommentNoFiles.

/**
     * Test commit with no files and one commit comment
     */
public void testSingleCommentNoFiles() {
    GitComment comment = GitComment.builder().build();
    Commit commit = Commit.builder().build();
    FullCommit full = new FullCommit(commit, Collections.singletonList(comment));
    assertFalse(full.isEmpty());
    assertEquals(comment, full.get(0));
    assertTrue(full.getFiles().isEmpty());
}
Also used : Commit(com.meisolsson.githubsdk.model.Commit) FullCommit(com.github.pockethub.android.core.commit.FullCommit) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitComment(com.meisolsson.githubsdk.model.git.GitComment)

Example 2 with FullCommit

use of com.github.pockethub.android.core.commit.FullCommit in project PocketHub by pockethub.

the class FullCommitTest method testBothTypesOfComments.

/**
     * Test commit with line and global comments
     */
public void testBothTypesOfComments() {
    GitHubFile file = GitHubFile.builder().filename("a.txt").build();
    GitComment comment1 = GitComment.builder().path(file.filename()).position(10).build();
    GitComment comment2 = GitComment.builder().build();
    Commit commit = Commit.builder().files(Collections.singletonList(file)).build();
    FullCommit full = new FullCommit(commit, new ArrayList<>(Arrays.asList(comment1, comment2)));
    assertEquals(1, full.size());
    assertEquals(comment2, full.get(0));
    assertEquals(1, full.getFiles().size());
    assertEquals(comment1, full.getFiles().get(0).get(10).get(0));
}
Also used : Commit(com.meisolsson.githubsdk.model.Commit) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitHubFile(com.meisolsson.githubsdk.model.GitHubFile) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitComment(com.meisolsson.githubsdk.model.git.GitComment)

Example 3 with FullCommit

use of com.github.pockethub.android.core.commit.FullCommit in project PocketHub by pockethub.

the class FullCommitTest method testSingleCommentSingleFile.

/**
     * Test commit with one file and one commit comment
     */
public void testSingleCommentSingleFile() {
    GitHubFile file = GitHubFile.builder().filename("a.txt").build();
    GitComment comment = GitComment.builder().build();
    Commit commit = Commit.builder().files(Collections.singletonList(file)).build();
    FullCommit full = new FullCommit(commit, Collections.singletonList(comment));
    assertFalse(full.isEmpty());
    assertEquals(comment, full.get(0));
    assertEquals(1, full.getFiles().size());
}
Also used : Commit(com.meisolsson.githubsdk.model.Commit) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitHubFile(com.meisolsson.githubsdk.model.GitHubFile) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitComment(com.meisolsson.githubsdk.model.git.GitComment)

Example 4 with FullCommit

use of com.github.pockethub.android.core.commit.FullCommit in project PocketHub by pockethub.

the class FullCommitTest method testNoCommentsSingleFile.

/**
     * Test commit with no comments and one file
     */
public void testNoCommentsSingleFile() {
    GitHubFile file = GitHubFile.builder().filename("a.txt").build();
    Commit commit = Commit.builder().files(Collections.singletonList(file)).build();
    FullCommit full = new FullCommit(commit);
    assertTrue(full.isEmpty());
    assertEquals(1, full.getFiles().size());
}
Also used : Commit(com.meisolsson.githubsdk.model.Commit) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitHubFile(com.meisolsson.githubsdk.model.GitHubFile) FullCommit(com.github.pockethub.android.core.commit.FullCommit)

Example 5 with FullCommit

use of com.github.pockethub.android.core.commit.FullCommit in project PocketHub by pockethub.

the class FullCommitTest method testSingleLineCommentSingleFile.

/**
     * Test commit with one file and one line comment
     */
public void testSingleLineCommentSingleFile() {
    GitHubFile file = GitHubFile.builder().filename("a.txt").build();
    GitComment comment = GitComment.builder().path(file.filename()).position(10).build();
    Commit commit = Commit.builder().files(Collections.singletonList(file)).build();
    FullCommit full = new FullCommit(commit, new ArrayList<>(Collections.singletonList(comment)));
    assertTrue(full.isEmpty());
    assertEquals(1, full.getFiles().size());
    assertEquals(comment, full.getFiles().get(0).get(10).get(0));
}
Also used : Commit(com.meisolsson.githubsdk.model.Commit) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitHubFile(com.meisolsson.githubsdk.model.GitHubFile) FullCommit(com.github.pockethub.android.core.commit.FullCommit) GitComment(com.meisolsson.githubsdk.model.git.GitComment)

Aggregations

FullCommit (com.github.pockethub.android.core.commit.FullCommit)5 Commit (com.meisolsson.githubsdk.model.Commit)5 GitHubFile (com.meisolsson.githubsdk.model.GitHubFile)4 GitComment (com.meisolsson.githubsdk.model.git.GitComment)4