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());
}
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));
}
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());
}
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());
}
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));
}
Aggregations