use of com.meisolsson.githubsdk.model.payload.FollowPayload in project PocketHub by pockethub.
the class NewsEventTextTest method testFollow.
/**
* Verify text of follow event
*/
@UiThreadTest
public void testFollow() {
User target = User.builder().login("user2").build();
FollowPayload payload = FollowPayload.builder().target(target).build();
GitHubEvent event = createEvent(GitHubEventType.FollowEvent, payload);
updateView(event);
verify("user started following user2");
}
use of com.meisolsson.githubsdk.model.payload.FollowPayload in project PocketHub by pockethub.
the class UserEventMatcher method getUsers.
/**
* Get {@link UserPair} from event
*
* @param event
* @return user or null if event doesn't apply
*/
public UserPair getUsers(final GitHubEvent event) {
if (event == null || event.payload() == null) {
return null;
}
GitHubEventType type = event.type();
if (GitHubEventType.FollowEvent.equals(type)) {
User from = event.actor();
User to = ((FollowPayload) event.payload()).target();
if (from != null && to != null) {
return new UserPair(from, to);
}
}
return null;
}
Aggregations