1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.internal.json;
18
19 import com.atlassian.jira.rest.client.domain.BasicIssueType;
20 import org.codehaus.jettison.json.JSONException;
21 import org.junit.Test;
22
23 import static com.atlassian.jira.rest.client.TestUtil.toUri;
24 import static org.junit.Assert.assertEquals;
25
26 public class BasicIssueTypeJsonParserTest {
27
28 @Test
29 public void testParse() throws JSONException {
30 BasicIssueTypeJsonParser parser = new BasicIssueTypeJsonParser();
31 final BasicIssueType issueType = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/issueType/valid.json"));
32 assertEquals(new BasicIssueType(toUri("http://localhost:8090/jira/rest/api/latest/issueType/1"), 1L, "Bug", true), issueType);
33 }
34
35 @Test
36 public void testParseWithoutId() throws JSONException {
37 BasicIssueTypeJsonParser parser = new BasicIssueTypeJsonParser();
38 final BasicIssueType issueType = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/issueType/valid-without-id.json"));
39 assertEquals(new BasicIssueType(toUri("http://localhost:8090/jira/rest/api/latest/issueType/1"), null, "Bug", true), issueType);
40 }
41
42 }