@Test(expected = ConquesoCommunicationException.class)
  public void getPropertyValue_miss() throws IOException {
    String key = "foo";
    String value = "bar";

    ConquesoClient client = createClientReturningString(key, value);
    client.getPropertyValue("baz");
  }
 @Test
 public void parseConquesoDate() throws ParseException {
   assertEquals(
       createDate(2014, 1, 5, 17, 5, 39),
       ConquesoClient.parseConquesoDate("2014-02-05T17:05:39.000Z"));
   assertEquals(
       createDate(2015, 0, 31, 12, 5, 39),
       ConquesoClient.parseConquesoDate("2015-01-31T12:05:39.000Z"));
 }
  @Test
  public void getPropertyValue_hit() throws IOException {
    String key = "foo";
    String value = "bar";

    ConquesoClient client = createClientReturningString("properties/" + key, value);
    String result = client.getPropertyValue(key);

    assertEquals(value, result);
  }
  @Test
  public void getInstances() throws IOException {
    String response = readFileAsString("instances-response.json");

    List<InstanceInfo> expected = getExpectedInstances();

    ConquesoClient client = createClientReturningString("/api/instances", response);

    ImmutableList<InstanceInfo> result = client.getInstances();
    assertEquals(expected, result);
  }
  @Test
  public void getInstancesWithMetadataMap() throws IOException {
    String response = readFileAsString("instances-response.json");

    List<InstanceInfo> expected = getExpectedInstances();

    ConquesoClient client =
        createClientReturningString("/api/instances?availability-zone=us-east-1d", response);

    ImmutableList<InstanceInfo> result =
        client.getInstancesWithMetadata(ImmutableMap.of("availability-zone", "us-east-1d"));
    assertEquals(expected, result);
  }
  @Test
  public void getRoles() throws IOException {
    String response = readFileAsString("roles-response.json");

    List<RoleInfo> expected =
        ImmutableList.of(
            new RoleInfo("analytics-service", 5), new RoleInfo("test-framework-server", 1));

    ConquesoClient client = createClientReturningString("/api/roles", response);
    ImmutableList<RoleInfo> results = client.getRoles();

    assertEquals(expected, results);
  }
  @Test
  public void getRoleInstancesWithMetadata() throws IOException {
    String response = readFileAsString("instances-response.json");

    List<InstanceInfo> expected = getExpectedInstances();

    ConquesoClient client =
        createClientReturningString(
            "/api/roles/analytics-service/instances?availability-zone=us-east-1d&instance-type=m1.small",
            response);

    ImmutableList<InstanceInfo> result =
        client.getRoleInstancesWithMetadata(
            "analytics-service", "availability-zone", "us-east-1d", "instance-type", "m1.small");
    assertEquals(expected, result);
  }