Search in sources :

Example 36 with GitHubEvent

use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.

the class RepositoryEventMatcherTest method testIncompleteRepositoryFork.

/**
 * Test fork event that has an incomplete forkee in the payload
 */
public void testIncompleteRepositoryFork() {
    RepositoryEventMatcher matcher = new RepositoryEventMatcher();
    ForkPayload payload = ForkPayload.builder().build();
    GitHubEvent event = GitHubEvent.builder().type(GitHubEventType.ForkEvent).payload(payload).build();
    assertNull(matcher.getRepository(event));
    Repository repository = Repository.builder().build();
    payload = payload.toBuilder().forkee(repository).build();
    event = event.toBuilder().payload(payload).build();
    assertNull(matcher.getRepository(event));
    repository = repository.toBuilder().name("repo").build();
    payload = payload.toBuilder().forkee(repository).build();
    event = event.toBuilder().payload(payload).build();
    assertNull(matcher.getRepository(event));
    User user = User.builder().build();
    repository = repository.toBuilder().owner(user).build();
    payload = payload.toBuilder().forkee(repository).build();
    event = event.toBuilder().payload(payload).build();
    assertNull(matcher.getRepository(event));
    user = user.toBuilder().login("owner").build();
    repository = repository.toBuilder().owner(user).build();
    payload = payload.toBuilder().forkee(repository).build();
    event = event.toBuilder().payload(payload).build();
    assertEquals(repository, matcher.getRepository(event));
}
Also used : ForkPayload(com.meisolsson.githubsdk.model.payload.ForkPayload) Repository(com.meisolsson.githubsdk.model.Repository) User(com.meisolsson.githubsdk.model.User) RepositoryEventMatcher(com.github.pockethub.android.core.repo.RepositoryEventMatcher) GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent)

Example 37 with GitHubEvent

use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.

the class NewsEventTextTest method testCreateRepositoryEvent.

/**
 * Verify text of create event
 */
@UiThreadTest
public void testCreateRepositoryEvent() {
    CreatePayload payload = CreatePayload.builder().refType(ReferenceType.Repository).build();
    GitHubEvent event = createEvent(GitHubEventType.CreateEvent, payload);
    updateView(event);
    verify("user created repository repo");
}
Also used : CreatePayload(com.meisolsson.githubsdk.model.payload.CreatePayload) GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent) UiThreadTest(android.test.UiThreadTest)

Example 38 with GitHubEvent

use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.

the class NewsEventTextTest method testOpenSourced.

/**
 * Verify text of open sourced event
 */
@UiThreadTest
public void testOpenSourced() {
    GitHubEvent event = createEvent(GitHubEventType.PublicEvent, null);
    updateView(event);
    verify("user open sourced repository user/repo");
}
Also used : GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent) UiThreadTest(android.test.UiThreadTest)

Example 39 with GitHubEvent

use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.

the class NewsEventTextTest method testPush.

/**
 * Verify text of push event
 */
@UiThreadTest
public void testPush() {
    PushPayload payload = PushPayload.builder().ref("refs/heads/master").commits(Collections.emptyList()).build();
    GitHubEvent event = createEvent(GitHubEventType.PushEvent, payload);
    updateView(event);
    verify("user pushed to master at user/repo");
}
Also used : PushPayload(com.meisolsson.githubsdk.model.payload.PushPayload) GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent) UiThreadTest(android.test.UiThreadTest)

Example 40 with GitHubEvent

use of com.meisolsson.githubsdk.model.GitHubEvent in project PocketHub by pockethub.

the class NewsEventTextTest method testTeamAdd.

/**
 * Verify text of push event
 */
@UiThreadTest
public void testTeamAdd() {
    Team team = Team.builder().name("t1").build();
    Repository repo = Repository.builder().name("r2").build();
    TeamAddPayload payload = TeamAddPayload.builder().repository(repo).team(team).build();
    GitHubEvent event = createEvent(GitHubEventType.TeamAddEvent, payload);
    updateView(event);
    verify("user added r2 to team t1");
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) TeamAddPayload(com.meisolsson.githubsdk.model.payload.TeamAddPayload) Team(com.meisolsson.githubsdk.model.Team) GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent) UiThreadTest(android.test.UiThreadTest)

Aggregations

GitHubEvent (com.meisolsson.githubsdk.model.GitHubEvent)43 Test (org.junit.Test)18 UiThreadTest (android.test.UiThreadTest)15 Repository (com.meisolsson.githubsdk.model.Repository)9 User (com.meisolsson.githubsdk.model.User)8 IssuesPayload (com.meisolsson.githubsdk.model.payload.IssuesPayload)8 Issue (com.meisolsson.githubsdk.model.Issue)6 CreatePayload (com.meisolsson.githubsdk.model.payload.CreatePayload)5 FollowPayload (com.meisolsson.githubsdk.model.payload.FollowPayload)5 IssueCommentPayload (com.meisolsson.githubsdk.model.payload.IssueCommentPayload)5 PullRequestPayload (com.meisolsson.githubsdk.model.payload.PullRequestPayload)5 PushPayload (com.meisolsson.githubsdk.model.payload.PushPayload)5 CommitCommentPayload (com.meisolsson.githubsdk.model.payload.CommitCommentPayload)4 DownloadPayload (com.meisolsson.githubsdk.model.payload.DownloadPayload)4 ForkPayload (com.meisolsson.githubsdk.model.payload.ForkPayload)4 GistPayload (com.meisolsson.githubsdk.model.payload.GistPayload)4 GollumPayload (com.meisolsson.githubsdk.model.payload.GollumPayload)4 ReleasePayload (com.meisolsson.githubsdk.model.payload.ReleasePayload)4 List (java.util.List)4 View (android.view.View)3