public void testViewAttachment() throws Exception {
    // first try to open the issue that contains the attachments
    Issue mky1 = issueClient.get("MKY-1");
    assertThat(mky1.fields.attachment.size(), equalTo(3));

    // {
    //   self: http://localhost:8090/jira/rest/api/2/attachment/10000
    //   filename: attachment.txt
    //   author: {
    //     self: http://localhost:8090/jira/rest/api/2/user?username=admin
    //     name: admin
    //     displayName: Administrator
    //   }
    //   created: 2010-06-09T15:59:34.602+1000
    //   size: 19
    //   mimeType: text/plain
    //   properties: {
    //     magickey7: 1311805918487
    //     magickey6: "Picture of an big long elephant"
    //     magickey5: "Picture of an elephant"
    //     magickey4: 3.14
    //     magickey3: 1212121
    //     magickey2: 11
    //     magickey1: true
    //   }
    //   content: http://localhost:8090/jira/secure/attachment/10000/attachment.txt
    // }

    // now go and verify one of those attachments
    Attachment attachment1 = attachmentClient.get("10000");
    assertEquals(getBaseUrl() + "/rest/api/2/attachment/10000", attachment1.self);
    assertEquals("attachment.txt", attachment1.filename);
    assertEquals(getBaseUrl() + "/rest/api/2/user?username=admin", attachment1.author.self);
    assertEquals(ADMIN_USERNAME, attachment1.author.name);
    assertEquals(ADMIN_FULLNAME, attachment1.author.displayName);
    assertEqualDateStrings("2010-06-09T15:59:34.602+1000", attachment1.created);
    assertEquals(19L, attachment1.size);
    assertEquals("text/plain", attachment1.mimeType);
    assertEquals(getBaseUrl() + "/secure/attachment/10000/attachment.txt", attachment1.content);
    assertTrue((Boolean) attachment1.properties.get("magickey1"));
    assertEquals(Integer.valueOf(11), attachment1.properties.get("magickey2"));
    assertEquals(Integer.valueOf(1212121), attachment1.properties.get("magickey3"));
    assertEquals(Double.valueOf(3.14), attachment1.properties.get("magickey4"));
    assertEquals("Picture of an elephant", attachment1.properties.get("magickey5"));
    assertEquals("Picture of an big long elephant", attachment1.properties.get("magickey6"));
    assertEquals("2011-07-28T08:31:58.487+1000", attachment1.properties.get("magickey7"));
  }
  public void testRemoveAttachment() throws Exception {
    // first try to open the issue that contains the attachments
    Issue mky1 = issueClient.get("MKY-1");
    assertThat(mky1.fields.attachment.size(), equalTo(3));

    // Get the attachment first
    Attachment attachment1 = attachmentClient.get("10000");
    assertEquals("attachment.txt", attachment1.filename);
    // Delete it
    Response response = attachmentClient.deleteResponse("10000");
    assertEquals(204, response.statusCode);

    // Try and get the attachment again, should be 404
    response = attachmentClient.getResponse("10000");
    assertEquals(404, response.statusCode);
    mky1 = issueClient.get("MKY-1");
    assertThat(mky1.fields.attachment.size(), equalTo(2));
  }