* <p/>
* See feature request http://www.redmine.org/issues/9664
*/
@Test
public void testCustomFields() throws Exception {
Issue issue = createIssues(issueManager, projectKey, 1).get(0);
// default empty values
assertThat(issue.getCustomFields().size()).isEqualTo(2);
// TODO update this!
int id1 = 1; // TODO this is pretty much a hack, we don't generally know
// these ids!
String custom1FieldName = "my_custom_1";
String custom1Value = "some value 123";
int id2 = 2;
String custom2FieldName = "custom_boolean_1";
String custom2Value = "true";
issue.clearCustomFields();
issue.addCustomField(CustomFieldFactory.create(id1, custom1FieldName, custom1Value));
issue.addCustomField(CustomFieldFactory.create(id2, custom2FieldName, custom2Value));
issueManager.update(issue);
Issue updatedIssue = issueManager.getIssueById(issue.getId());
assertThat(updatedIssue.getCustomFields().size()).isEqualTo(2);
assertEquals(custom1Value,
updatedIssue.getCustomField(custom1FieldName));
assertEquals(custom2Value,
updatedIssue.getCustomField(custom2FieldName));
}