public void listSplitsOnNewline() throws Exception {
    MockWebServer server = new MockWebServer();
    server.enqueue(new MockResponse().setBody("route53-readonly\nbooberry"));
    server.play();
    try {
      assertEquals(
          InstanceMetadataHook.list(
              server.getUrl(InstanceMetadataHook.DEFAULT_URI.getPath()).toURI(),
              "iam/security-credentials/"),
          ImmutableList.of("route53-readonly", "booberry"));

    } finally {
      assertEquals(
          server.takeRequest().getRequestLine(),
          "GET /latest/meta-data/iam/security-credentials/ HTTP/1.1");
      server.shutdown();
    }
  }
 @Test(
     expectedExceptions = IllegalArgumentException.class,
     expectedExceptionsMessageRegExp = "path must end with '/'; iam/security-credentials provided")
 public void listPathEndsInSlash() throws Exception {
   InstanceMetadataHook.list("iam/security-credentials");
 }