From d53ad6370a1585b88859c1b63ba5931ea700cc3b Mon Sep 17 00:00:00 2001 From: Greg Messner Date: Fri, 14 Dec 2018 16:02:17 -0800 Subject: [PATCH] Modified to use JsonUtils. --- .../org/gitlab4j/api/TestGitLabApiBeans.java | 703 +++++------------- 1 file changed, 193 insertions(+), 510 deletions(-) diff --git a/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java b/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java index f0b04550..f02578cd 100644 --- a/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java +++ b/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java @@ -4,7 +4,7 @@ * Copyright (c) 2017 Greg Messner * * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in + * this software and associated documentation files (the "Software.json"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, @@ -23,9 +23,12 @@ package org.gitlab4j.api; +import static org.gitlab4j.api.JsonUtils.compareJson; +import static org.gitlab4j.api.JsonUtils.unmarshalResource; +import static org.gitlab4j.api.JsonUtils.unmarshalResourceList; +import static org.gitlab4j.api.JsonUtils.unmarshalResourceMap; import static org.junit.Assert.assertTrue; -import java.io.IOException; import java.util.List; import java.util.Map; @@ -80,697 +83,377 @@ import org.gitlab4j.api.systemhooks.SystemHookEvent; import org.gitlab4j.api.systemhooks.TeamMemberSystemHookEvent; import org.junit.Test; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - public class TestGitLabApiBeans { - private T unmarshal(Class returnType, String file) throws JsonParseException, JsonMappingException, IOException { - return (JsonUtils.unmarshal(returnType, file + ".json")); - } - - private List unmarshalList(Class returnType, String file) throws JsonParseException, JsonMappingException, IOException { - return (JsonUtils.unmarshalList(returnType, file + ".json")); - } - - private boolean compareJson(T apiObject, String file) throws IOException { - return (JsonUtils.compareJson(apiObject, file + ".json")); - } - - @Test - public void testAwardEmoji() { - - try { - AwardEmoji awardEmoji = unmarshal(AwardEmoji.class, "award-emoji"); - assertTrue(compareJson(awardEmoji, "award-emoji")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testAwardEmoji() throws Exception { + AwardEmoji awardEmoji = unmarshalResource(AwardEmoji.class, "award-emoji.json"); + assertTrue(compareJson(awardEmoji, "award-emoji.json")); } @Test - public void testBranch() { + public void testBranch() throws Exception { - try { - Branch branch = unmarshal(Branch.class, "branch"); - assertTrue(compareJson(branch, "branch")); + Branch branch = unmarshalResource(Branch.class, "branch.json"); + assertTrue(compareJson(branch, "branch.json")); - branch = unmarshal(Branch.class, "bad-branch"); - assertTrue(!Branch.isValid(branch)); - } catch (Exception e) { - e.printStackTrace(); - } + branch = unmarshalResource(Branch.class, "bad-branch.json"); + assertTrue(!Branch.isValid(branch)); } - - @Test - public void testCommit() { - try { - Commit commit = unmarshal(Commit.class, "commit"); - assertTrue(compareJson(commit, "commit")); - } catch (Exception e) { - e.printStackTrace(); - } + @Test + public void testCommit() throws Exception { + Commit commit = unmarshalResource(Commit.class, "commit.json"); + assertTrue(compareJson(commit, "commit.json")); } @Test - public void testCommitPayload() { - - try { - CommitPayload commitPayload = unmarshal(CommitPayload.class, "commit-payload"); - assertTrue(compareJson(commitPayload, "commit-payload")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testCommitPayload() throws Exception { + CommitPayload commitPayload = unmarshalResource(CommitPayload.class, "commit-payload.json"); + assertTrue(compareJson(commitPayload, "commit-payload.json")); } @Test - public void testCommitStatus() { - - try { - CommitStatus commitStatus = unmarshal(CommitStatus.class, "commit-status"); - assertTrue(compareJson(commitStatus, "commit-status")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testCommitStatus() throws Exception { + CommitStatus commitStatus = unmarshalResource(CommitStatus.class, "commit-status.json"); + assertTrue(compareJson(commitStatus, "commit-status.json")); } @Test - public void testCompareResults() { - - try { - CompareResults compareResults = unmarshal(CompareResults.class, "compare-results"); - assertTrue(compareJson(compareResults, "compare-results")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testCompareResults() throws Exception { + CompareResults compareResults = unmarshalResource(CompareResults.class, "compare-results.json"); + assertTrue(compareJson(compareResults, "compare-results.json")); } @Test - public void testDiff() { - - try { - Diff diff = unmarshal(Diff.class, "diff"); - assertTrue(compareJson(diff, "diff")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testDiff() throws Exception { + Diff diff = unmarshalResource(Diff.class, "diff.json"); + assertTrue(compareJson(diff, "diff.json")); } @Test - public void testComment() { - - try { - Comment comment = unmarshal(Comment.class, "comment"); - assertTrue(compareJson(comment, "comment")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testComment() throws Exception { + Comment comment = unmarshalResource(Comment.class, "comment.json"); + assertTrue(compareJson(comment, "comment.json")); } @Test - public void testEpic() { - - try { - Epic epic = unmarshal(Epic.class, "epic"); - assertTrue(compareJson(epic, "epic")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testEpic() throws Exception { + Epic epic = unmarshalResource(Epic.class, "epic.json"); + assertTrue(compareJson(epic, "epic.json")); } @Test - public void testEpicIssue() { - - try { - EpicIssue epicIssue = unmarshal(EpicIssue.class, "epic-issue"); - assertTrue(compareJson(epicIssue, "epic-issue")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testEpicIssue() throws Exception { + EpicIssue epicIssue = unmarshalResource(EpicIssue.class, "epic-issue.json"); + assertTrue(compareJson(epicIssue, "epic-issue.json")); } @Test - public void testEvent() { - - try { - Event event = unmarshal(Event.class, "event"); - assertTrue(compareJson(event, "event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testEvent() throws Exception { + Event event = unmarshalResource(Event.class, "event.json"); + assertTrue(compareJson(event, "event.json")); } @Test - public void testFileUpload() { - - try { - FileUpload fileUpload = unmarshal(FileUpload.class, "file-upload"); - assertTrue(compareJson(fileUpload, "file-upload")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testFileUpload() throws Exception { + FileUpload fileUpload = unmarshalResource(FileUpload.class, "file-upload.json"); + assertTrue(compareJson(fileUpload, "file-upload.json")); } @Test - public void testGroup() { - - try { - Group group = unmarshal(Group.class, "group"); - assertTrue(compareJson(group, "group")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testGroup() throws Exception { + Group group = unmarshalResource(Group.class, "group.json"); + assertTrue(compareJson(group, "group.json")); } @Test - public void testHealthCheckInfo() { - - try { - HealthCheckInfo healthCheck = unmarshal(HealthCheckInfo.class, "health-check"); - assertTrue(compareJson(healthCheck, "health-check")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testHealthCheckInfo() throws Exception { + HealthCheckInfo healthCheck = unmarshalResource(HealthCheckInfo.class, "health-check.json"); + assertTrue(compareJson(healthCheck, "health-check.json")); } @Test - public void testIssue() { - - try { - Issue issue = unmarshal(Issue.class, "issue"); - assertTrue(compareJson(issue, "issue")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testIssue() throws Exception { + Issue issue = unmarshalResource(Issue.class, "issue.json"); + assertTrue(compareJson(issue, "issue.json")); } @Test - public void testCommitDiscussions() { - - try { - List discussions = unmarshalList(Discussion.class, "commit-discussions"); - assertTrue(compareJson(discussions, "commit-discussions")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testCommitDiscussions() throws Exception { + List discussions = unmarshalResourceList(Discussion.class, "commit-discussions.json"); + assertTrue(compareJson(discussions, "commit-discussions.json")); } @Test - public void testEpicDiscussions() { - - try { - List discussions = unmarshalList(Discussion.class, "epic-discussions"); - assertTrue(compareJson(discussions, "epic-discussions")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testEpicDiscussions() throws Exception { + List discussions = unmarshalResourceList(Discussion.class, "epic-discussions.json"); + assertTrue(compareJson(discussions, "epic-discussions.json")); } @Test - public void testIssueDiscussions() { - - try { - List discussions = unmarshalList(Discussion.class, "issue-discussions"); - assertTrue(compareJson(discussions, "issue-discussions")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testIssueDiscussions() throws Exception { + List discussions = unmarshalResourceList(Discussion.class, "issue-discussions.json"); + assertTrue(compareJson(discussions, "issue-discussions.json")); } @Test - public void testMergeRequestDiscussions() { - - try { - List discussions = unmarshalList(Discussion.class, "merge-request-discussions"); - assertTrue(compareJson(discussions, "merge-request-discussions")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testMergeRequestDiscussions() throws Exception { + List discussions = unmarshalResourceList(Discussion.class, "merge-request-discussions.json"); + assertTrue(compareJson(discussions, "merge-request-discussions.json")); } - @Test - public void testSnippetDiscussions() { - - try { - List discussions = unmarshalList(Discussion.class, "snippet-discussions"); - assertTrue(compareJson(discussions, "snippet-discussions")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testSnippetDiscussions() throws Exception { + List discussions = unmarshalResourceList(Discussion.class, "snippet-discussions.json"); + assertTrue(compareJson(discussions, "snippet-discussions.json")); } @Test - public void testPipeline() { - - try { - Pipeline pipeline = unmarshal(Pipeline.class, "pipeline"); - assertTrue(compareJson(pipeline, "pipeline")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testPipeline() throws Exception { + Pipeline pipeline = unmarshalResource(Pipeline.class, "pipeline.json"); + assertTrue(compareJson(pipeline, "pipeline.json")); } @Test - public void testJob() { - - try { - Job job = unmarshal(Job.class, "job"); - assertTrue(compareJson(job, "job")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testJob() throws Exception { + Job job = unmarshalResource(Job.class, "job.json"); + assertTrue(compareJson(job, "job.json")); } @Test - public void testDeployKeys() { - - try { - List deployKeys = unmarshalList(DeployKey.class, "deploy-keys"); - assertTrue(compareJson(deployKeys, "deploy-keys")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testDeployKeys() throws Exception { + List deployKeys = unmarshalResourceList(DeployKey.class, "deploy-keys.json"); + assertTrue(compareJson(deployKeys, "deploy-keys.json")); } @Test - public void testArtifactsFile() { - - try { - ArtifactsFile artifactFile = unmarshal(ArtifactsFile.class, "artifacts-file"); - assertTrue(compareJson(artifactFile, "artifacts-file")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testArtifactsFile() throws Exception { + ArtifactsFile artifactFile = unmarshalResource(ArtifactsFile.class, "artifacts-file.json"); + assertTrue(compareJson(artifactFile, "artifacts-file.json")); } @Test - public void testProjectLanguages() { - - try { - Map projectLanguages = JsonUtils.unmarshalMap(Float.class, "project-languages.json"); - assertTrue(compareJson(projectLanguages, "project-languages")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProjectLanguages() throws Exception { + Map projectLanguages = unmarshalResourceMap(Float.class, "project-languages.json"); + assertTrue(compareJson(projectLanguages, "project-languages.json")); } @Test - public void testProjectUsers() { - - try { - List projectUsers = unmarshalList(ProjectUser.class, "project-users"); - assertTrue(compareJson(projectUsers, "project-users")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProjectUsers() throws Exception { + List projectUsers = unmarshalResourceList(ProjectUser.class, "project-users.json"); + assertTrue(compareJson(projectUsers, "project-users.json")); } @Test - public void testProjectHook() { - - try { - ProjectHook hook = unmarshal(ProjectHook.class, "hook"); - assertTrue(compareJson(hook, "hook")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProjectHook() throws Exception { + ProjectHook hook = unmarshalResource(ProjectHook.class, "hook.json"); + assertTrue(compareJson(hook, "hook.json")); } @Test - public void testProjectEvents() { - - try { - List events = unmarshalList(Event.class, "project-events"); - assertTrue(compareJson(events, "project-events")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProjectEvents() throws Exception { + List events = unmarshalResourceList(Event.class, "project-events.json"); + assertTrue(compareJson(events, "project-events.json")); } @Test - public void testProtectedBranch() { - - try { - ProtectedBranch protectedBranch = unmarshal(ProtectedBranch.class, "protected-branch"); - assertTrue(compareJson(protectedBranch, "protected-branch")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProtectedBranch() throws Exception { + ProtectedBranch protectedBranch = unmarshalResource(ProtectedBranch.class, "protected-branch.json"); + assertTrue(compareJson(protectedBranch, "protected-branch.json")); } @Test - public void testPushRule() { - - try { - PushRules pushRule = unmarshal(PushRules.class, "push-rule"); - assertTrue(compareJson(pushRule, "push-rule")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testPushRule() throws Exception { + PushRules pushRule = unmarshalResource(PushRules.class, "push-rule.json"); + assertTrue(compareJson(pushRule, "push-rule.json")); } @Test - public void testRunnerDetail() { - - try { - RunnerDetail runnerDetail = unmarshal(RunnerDetail.class, "runner-detail"); - assertTrue(compareJson(runnerDetail, "runner-detail")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testRunnerDetail() throws Exception { + RunnerDetail runnerDetail = unmarshalResource(RunnerDetail.class, "runner-detail.json"); + assertTrue(compareJson(runnerDetail, "runner-detail.json")); } @Test - public void testAllRunners() { - - try { - List allRunners = unmarshalList(Runner.class, "all-runners"); - assertTrue(compareJson(allRunners, "all-runners")); - - } catch (Exception e) { - e.printStackTrace(); - } + public void testAllRunners() throws Exception { + List allRunners = unmarshalResourceList(Runner.class, "all-runners.json"); + assertTrue(compareJson(allRunners, "all-runners.json")); } @Test - public void testJiraService() { - - try { - JiraService jira = unmarshal(JiraService.class, "jira"); - assertTrue(compareJson(jira, "jira")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testJiraService() throws Exception { + JiraService jira = unmarshalResource(JiraService.class, "jira.json"); + assertTrue(compareJson(jira, "jira.json")); } @Test - public void testKey() { - - try { - Key key = unmarshal(Key.class, "key"); - assertTrue(compareJson(key, "key")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testKey() throws Exception { + Key key = unmarshalResource(Key.class, "key.json"); + assertTrue(compareJson(key, "key.json")); } @Test - public void testMember() { - - try { - Member member = unmarshal(Member.class, "member"); - assertTrue(compareJson(member, "member")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testMember() throws Exception { + Member member = unmarshalResource(Member.class, "member.json"); + assertTrue(compareJson(member, "member.json")); } @Test - public void testMergeRequestApprovals() { - - try { - MergeRequest mergeRequestApprovals = unmarshal(MergeRequest.class, "approvals"); - assertTrue(compareJson(mergeRequestApprovals, "approvals")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testMergeRequestApprovals() throws Exception { + MergeRequest mergeRequestApprovals = unmarshalResource(MergeRequest.class, "approvals.json"); + assertTrue(compareJson(mergeRequestApprovals, "approvals.json")); } @Test - public void testMergeRequest() { - - try { - MergeRequest mergeRequest = unmarshal(MergeRequest.class, "merge-request"); - assertTrue(compareJson(mergeRequest, "merge-request")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testMergeRequest() throws Exception { + MergeRequest mergeRequest = unmarshalResource(MergeRequest.class, "merge-request.json"); + assertTrue(compareJson(mergeRequest, "merge-request.json")); } @Test - public void testMilestone() { - - try { - Milestone milestone = unmarshal(Milestone.class, "milestone"); - assertTrue(compareJson(milestone, "milestone")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testMilestone() throws Exception { + Milestone milestone = unmarshalResource(Milestone.class, "milestone.json"); + assertTrue(compareJson(milestone, "milestone.json")); } @Test - public void testNote() { - - try { - Note note = unmarshal(Note.class, "note"); - assertTrue(compareJson(note, "note")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testNote() throws Exception { + Note note = unmarshalResource(Note.class, "note.json"); + assertTrue(compareJson(note, "note.json")); } @Test - public void testMergeRequestNote() { - - try { - Note note = unmarshal(Note.class, "merge-request-note"); - assertTrue(compareJson(note, "merge-request-note")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testMergeRequestNote() throws Exception { + Note note = unmarshalResource(Note.class, "merge-request-note.json"); + assertTrue(compareJson(note, "merge-request-note.json")); } @Test - public void testNotificationSettings() { - - try { - NotificationSettings settings = unmarshal(NotificationSettings.class, "notification-settings"); - assertTrue(compareJson(settings, "notification-settings")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testNotificationSettings() throws Exception { + NotificationSettings settings = unmarshalResource(NotificationSettings.class, "notification-settings.json"); + assertTrue(compareJson(settings, "notification-settings.json")); } @Test - public void testProject() { - - try { - Project project = unmarshal(Project.class, "project"); - assertTrue(compareJson(project, "project")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProject() throws Exception { + Project project = unmarshalResource(Project.class, "project.json"); + assertTrue(compareJson(project, "project.json")); } @Test - public void testProjectSnippet() { - - try { - Snippet snippet = unmarshal(Snippet.class, "snippet"); - assertTrue(compareJson(snippet, "snippet")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProjectSnippet() throws Exception { + Snippet snippet = unmarshalResource(Snippet.class, "snippet.json"); + assertTrue(compareJson(snippet, "snippet.json")); } @Test - public void testSession() { - - try { - Session session = unmarshal(Session.class, "session"); - assertTrue(compareJson(session, "session")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testSession() throws Exception { + Session session = unmarshalResource(Session.class, "session.json"); + assertTrue(compareJson(session, "session.json")); } @Test - public void testSlackService() { - - try { - SlackService slackNotifications = unmarshal(SlackService.class, "slack-notifications"); - assertTrue(compareJson(slackNotifications, "slack-notifications")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testSlackService() throws Exception { + SlackService slackNotifications = unmarshalResource(SlackService.class, "slack-notifications.json"); + assertTrue(compareJson(slackNotifications, "slack-notifications.json")); } @Test - public void testSystemHook() { - - try { - SystemHook systemHook = unmarshal(SystemHook.class, "system-hook"); - assertTrue(compareJson(systemHook, "system-hook")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testSystemHook() throws Exception { + SystemHook systemHook = unmarshalResource(SystemHook.class, "system-hook.json"); + assertTrue(compareJson(systemHook, "system-hook.json")); } @Test - public void testTag() { - - try { - Tag tag = unmarshal(Tag.class, "tag"); - assertTrue(compareJson(tag, "tag")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testTag() throws Exception { + Tag tag = unmarshalResource(Tag.class, "tag.json"); + assertTrue(compareJson(tag, "tag.json")); } @Test - public void testSshKey() { - - try { - SshKey sshKey = unmarshal(SshKey.class, "sshkey"); - assertTrue(compareJson(sshKey, "sshkey")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testSshKey() throws Exception { + SshKey sshKey = unmarshalResource(SshKey.class, "sshkey.json"); + assertTrue(compareJson(sshKey, "sshkey.json")); } @Test - public void testTree() { - - try { - List tree = unmarshalList(TreeItem.class, "tree"); - assertTrue(compareJson(tree, "tree")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testTree() throws Exception { + List tree = unmarshalResourceList(TreeItem.class, "tree.json"); + assertTrue(compareJson(tree, "tree.json")); } @Test - public void testUser() { - - try { - User user = unmarshal(User.class, "user"); - assertTrue(compareJson(user, "user")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testUser() throws Exception { + User user = unmarshalResource(User.class, "user.json"); + assertTrue(compareJson(user, "user.json")); } @Test - public void testImpersonationToken() { - - try { - ImpersonationToken token = unmarshal(ImpersonationToken.class, "impersonation-token"); - assertTrue(compareJson(token, "impersonation-token")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testImpersonationToken() throws Exception { + ImpersonationToken token = unmarshalResource(ImpersonationToken.class, "impersonation-token.json"); + assertTrue(compareJson(token, "impersonation-token.json")); } @Test - public void testOauthToken() { - - try { - OauthTokenResponse token = unmarshal(OauthTokenResponse.class, "oauth-token"); - assertTrue(compareJson(token, "oauth-token")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testOauthToken() throws Exception { + OauthTokenResponse token = unmarshalResource(OauthTokenResponse.class, "oauth-token.json"); + assertTrue(compareJson(token, "oauth-token.json")); } @Test - public void testProjectSystemHookEvent() { - - try { - ProjectSystemHookEvent event = unmarshal(ProjectSystemHookEvent.class, "project-system-hook-event"); - assertTrue(compareJson(event, "project-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testProjectSystemHookEvent() throws Exception { + ProjectSystemHookEvent event = unmarshalResource(ProjectSystemHookEvent.class, + "project-system-hook-event.json"); + assertTrue(compareJson(event, "project-system-hook-event.json")); } @Test - public void testTeamMemberSystemHookEvent() { - - try { - TeamMemberSystemHookEvent event = unmarshal(TeamMemberSystemHookEvent.class, "team-member-system-hook-event"); - assertTrue(compareJson(event, "team-member-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testTeamMemberSystemHookEvent() throws Exception { + TeamMemberSystemHookEvent event = unmarshalResource(TeamMemberSystemHookEvent.class, + "team-member-system-hook-event.json"); + assertTrue(compareJson(event, "team-member-system-hook-event.json")); } @Test - public void testPushSystemHookEvent() { - - try { - PushSystemHookEvent event = unmarshal(PushSystemHookEvent.class, "push-system-hook-event"); - assertTrue(compareJson(event, "push-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testPushSystemHookEvent() throws Exception { + PushSystemHookEvent event = unmarshalResource(PushSystemHookEvent.class, "push-system-hook-event.json"); + assertTrue(compareJson(event, "push-system-hook-event.json")); } @Test - public void testUserSystemHookEvent() { - - try { - SystemHookEvent event = unmarshal(SystemHookEvent.class, "user-system-hook-event"); - assertTrue(compareJson(event, "user-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testUserSystemHookEvent() throws Exception { + SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "user-system-hook-event.json"); + assertTrue(compareJson(event, "user-system-hook-event.json")); } @Test - public void testGroupSystemHookEvent() { - - try { - SystemHookEvent event = unmarshal(SystemHookEvent.class, "group-system-hook-event"); - assertTrue(compareJson(event, "group-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testGroupSystemHookEvent() throws Exception { + SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "group-system-hook-event.json"); + assertTrue(compareJson(event, "group-system-hook-event.json")); } @Test - public void testGroupMemberSystemHookEvent() { - - try { - SystemHookEvent event = unmarshal(SystemHookEvent.class, "group-member-system-hook-event"); - assertTrue(compareJson(event, "group-member-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testGroupMemberSystemHookEvent() throws Exception { + SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "group-member-system-hook-event.json"); + assertTrue(compareJson(event, "group-member-system-hook-event.json")); } @Test - public void testTagPushSystemHookEvent() { - - try { - SystemHookEvent event = unmarshal(SystemHookEvent.class, "tag-push-system-hook-event"); - assertTrue(compareJson(event, "tag-push-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testTagPushSystemHookEvent() throws Exception { + SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "tag-push-system-hook-event.json"); + assertTrue(compareJson(event, "tag-push-system-hook-event.json")); } @Test - public void testRepositorySystemHookEvent() { - - try { - SystemHookEvent event = unmarshal(SystemHookEvent.class, "repository-system-hook-event"); - assertTrue(compareJson(event, "repository-system-hook-event")); - } catch (Exception e) { - e.printStackTrace(); - } + public void testRepositorySystemHookEvent() throws Exception { + SystemHookEvent event = unmarshalResource(SystemHookEvent.class, "repository-system-hook-event.json"); + assertTrue(compareJson(event, "repository-system-hook-event.json")); } @Test - public void testLabels() { - - try { - List