1 package com.atlassian.jira.rest.client.internal.json;
2
3 import com.atlassian.jira.rest.client.TestUtil;
4 import com.atlassian.jira.rest.client.api.domain.IssuelinksType;
5 import com.google.common.collect.Iterables;
6 import org.junit.Assert;
7 import org.junit.Test;
8
9 public class IssueLinkTypesJsonParserTest {
10 @Test
11 public void testParse() throws Exception {
12 IssueLinkTypesJsonParser parser = new IssueLinkTypesJsonParser();
13 final Iterable<IssuelinksType> issueLinks = parser.parse(ResourceUtil
14 .getJsonObjectFromResource("/json/issueLinks/issue-links-5.0.json"));
15 Assert.assertEquals(8, Iterables.size(issueLinks));
16 Assert.assertEquals(new IssuelinksType(TestUtil.toUri("https://jdog.atlassian.com/rest/api/2/issueLinkType/10160"),
17 "10160", "Bonfire Testing", "discovered while testing", "testing discovered"), Iterables.get(issueLinks, 0));
18
19 Assert.assertEquals(new IssuelinksType(TestUtil.toUri("https://jdog.atlassian.com/rest/api/2/issueLinkType/10020"),
20 "10020", "Relates", "is related to", "relates to"), Iterables.getLast(issueLinks));
21 }
22 }