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