Commit d53ad637 authored by Greg Messner's avatar Greg Messner
Browse files

Modified to use JsonUtils.

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