use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_issue_comment_then_icon_should_be_issue_comment_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_issue_comment_then_icon_should_be_issue_comment_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.IssueCommentEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatIssueComment(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_ISSUE_COMMENT, icon);
verify(spyIconAndViewTextManager).formatIssueComment(event, null, null);
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_issues_and_action_is_reopened_then_icon_should_be_issue_reopen_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_issues_and_action_is_reopened_then_icon_should_be_issue_reopen_and_its_text_should_be_formatted() throws Exception {
// Arrange
IssuesPayload payload = IssuesPayload.builder().action(IconAndViewTextManager.ISSUES_PAYLOAD_ACTION_REOPENED).build();
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.IssuesEvent).payload(payload).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatIssues(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_ISSUE_REOPEN, icon);
verify(spyIconAndViewTextManager).formatIssues(event, null, null);
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class NewsFragment method onListItemClick.
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
GitHubEvent event = (GitHubEvent) l.getItemAtPosition(position);
if (DownloadEvent.equals(event.type())) {
openDownload(event);
return;
}
if (PushEvent.equals(event.type())) {
openPush(event);
return;
}
if (CommitCommentEvent.equals(event.type())) {
openCommitComment(event);
return;
}
Issue issue = issueMatcher.getIssue(event);
if (issue != null) {
Repository repo = ConvertUtils.eventRepoToRepo(event.repo());
viewIssue(issue, repo);
return;
}
Gist gist = gistMatcher.getGist(event);
if (gist != null) {
startActivity(GistsViewActivity.createIntent(gist));
return;
}
Repository repo = repoMatcher.getRepository(event);
if (repo != null) {
viewRepository(repo);
}
UserPair users = userMatcher.getUsers(event);
if (users != null) {
viewUser(users);
}
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_watch_then_icon_should_be_star_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_watch_then_icon_should_be_star_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.WatchEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatWatch(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_STAR, icon);
verify(spyIconAndViewTextManager).formatWatch(event, null, null);
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_commit_comment_then_icon_should_be_comment_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_commit_comment_then_icon_should_be_comment_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.CommitCommentEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatCommitComment(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_COMMENT, icon);
verify(spyIconAndViewTextManager).formatCommitComment(event, null, null);
}
Aggregations