use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_gist_then_icon_should_be_gist_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_gist_then_icon_should_be_gist_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.GistEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatGist(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_GIST, icon);
verify(spyIconAndViewTextManager).formatGist(event, null, null);
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_push_then_icon_should_be_push_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_push_then_icon_should_be_push_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.PushEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatPush(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_PUSH, icon);
verify(spyIconAndViewTextManager).formatPush(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_closed_then_icon_should_be_issue_close_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_issues_and_action_is_closed_then_icon_should_be_issue_close_and_its_text_should_be_formatted() throws Exception {
// Arrange
IssuesPayload payload = IssuesPayload.builder().action(IconAndViewTextManager.ISSUES_PAYLOAD_ACTION_CLOSED).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_CLOSE, icon);
verify(spyIconAndViewTextManager).formatIssues(event, null, null);
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_create_then_icon_should_be_create_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_create_then_icon_should_be_create_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.CreateEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatCreate(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(TypefaceUtils.ICON_CREATE, icon);
verify(spyIconAndViewTextManager).formatCreate(event, null, null);
}
use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.
the class IconAndViewTextManagerTest method when_event_type_is_public_then_icon_should_be_null_and_its_text_should_be_formatted.
@Test
public void when_event_type_is_public_then_icon_should_be_null_and_its_text_should_be_formatted() throws Exception {
// Arrange
GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.PublicEvent).build();
IconAndViewTextManager iconAndViewTextManager = new IconAndViewTextManager(null);
IconAndViewTextManager spyIconAndViewTextManager = spy(iconAndViewTextManager);
doNothing().when(spyIconAndViewTextManager).formatPublic(event, null, null);
// Act
String icon = spyIconAndViewTextManager.setIconAndFormatStyledText(event, null, null);
// Assert
assertEquals(null, icon);
verify(spyIconAndViewTextManager).formatPublic(event, null, null);
}
Aggregations