Package com.atlassian.jira.rest.client.domain

Examples of com.atlassian.jira.rest.client.domain.Field


                value = valueParser.parse(jsonObject);
            } else {
                value = valueObject.toString();
        }
        }
        return new Field(id, name, type, value);
    }
View Full Code Here


public class JsonFieldParserTest {
  @Test
  public void testParse() throws Exception {
    JsonFieldParser parser = new JsonFieldParser();
    final JSONObject fieldsJs = ResourceUtil.getJsonObjectFromResource("/json/field/valid-fields.json");
    final Field field = parser.parse(fieldsJs.getJSONObject("customfield_10000"), "customfield_10000");
    assertEquals(1.45, (Double) field.getValue(), 0.001);

    final Field userField = parser.parse(fieldsJs.getJSONObject("customfield_10020"), "customfield_10020");
    assertEquals(TestConstants.USER1, userField.getValue());

  }
View Full Code Here

  }

  @Test
  public void testParseIssueWithUserPickerCustomFieldFilledOut() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-user-picker-custom-field-filled-out.json");
    final Field extraUserField = issue.getFieldByName("Extra User");
    assertNotNull(extraUserField);
    assertEquals(BasicUser.class, extraUserField.getValue().getClass());
    assertEquals(TestConstants.USER1, extraUserField.getValue());
  }
View Full Code Here

  }

  @Test
  public void testParseIssueWithUserPickerCustomFieldEmpty() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-user-picker-custom-field-empty.json");
    final Field extraUserField = issue.getFieldByName("Extra User");
    assertNotNull(extraUserField);
    assertNull(extraUserField.getValue());
  }
View Full Code Here

      try {
        if (SPECIAL_FIELDS.contains(key)) {
          continue;
        }
        final Object value = json.opt(key);
        res.add(new Field(key, namesMap.get(key), typesMap.get("key"), value != JSONObject.NULL ? value : null));
      } catch (final Exception e) {
        throw new JSONException("Error while parsing [" + key + "] field: " + e.getMessage()) {
          @Override
          public Throwable getCause() {
            return e;
View Full Code Here

  }

  @Test
  public void testParseIssueWithUserPickerCustomFieldFilledOut() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-user-picker-custom-field-filled-out.json");
    final Field extraUserField = issue.getFieldByName("Extra User");
    assertNotNull(extraUserField);
    assertEquals(BasicUser.class, extraUserField.getValue().getClass());
    assertEquals(TestConstants.USER1, extraUserField.getValue());
  }
View Full Code Here

  }

  @Test
  public void testParseIssueWithUserPickerCustomFieldEmpty() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-user-picker-custom-field-empty.json");
    final Field extraUserField = issue.getFieldByName("Extra User");
    assertNotNull(extraUserField);
    assertNull(extraUserField.getValue());
  }
View Full Code Here

      try {
        if (SPECIAL_FIELDS.contains(key)) {
          continue;
        }
        final Object value = json.opt(key);
        res.add(new Field(key, namesMap.get(key), typesMap.get("key"), value != JSONObject.NULL ? value : null));
      } catch (final Exception e) {
        throw new JSONException("Error while parsing [" + key + "] field: " + e.getMessage()) {
          @Override
          public Throwable getCause() {
            return e;
View Full Code Here

                value = valueParser.parse(jsonObject);
            } else {
                value = valueObject.toString();
        }
        }
        return new Field(id, name, type, value);
    }
View Full Code Here

      try {
        if (SPECIAL_FIELDS.contains(key)) {
          continue;
        }
        final Object value = json.opt(key);
        res.add(new Field(key, namesMap.get(key), typesMap.get("key"), value != JSONObject.NULL ? value : null));
      } catch (final Exception e) {
        throw new JSONException("Error while parsing [" + key + "] field: " + e.getMessage()) {
          @Override
          public Throwable getCause() {
            return e;
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.domain.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.