Search in sources :

Example 1 with ForkPayload

use of com.meisolsson.githubsdk.model.payload.ForkPayload 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)

Aggregations

RepositoryEventMatcher (com.github.pockethub.android.core.repo.RepositoryEventMatcher)1 GitHubEvent (com.meisolsson.githubsdk.model.GitHubEvent)1 Repository (com.meisolsson.githubsdk.model.Repository)1 User (com.meisolsson.githubsdk.model.User)1 ForkPayload (com.meisolsson.githubsdk.model.payload.ForkPayload)1