@Test
public void testConstructTFConfig() throws IOException {

  String spec = "{\"worker\":[\"host0:1234\", \"host1:1234\"], \"ps\":[\"host2:1234\"]}";
  String tfConfig = Utils.constructTFConfig(spec, "worker", 1);
  ObjectMapper mapper = new ObjectMapper();
  TFConfig config = mapper.readValue(tfConfig, new TypeReference<TFConfig>() { });
  assertEquals(config.getTask().getType(), "worker");
  assertEquals(config.getTask().getIndex(), 1);
  assertEquals(config.getCluster().get("worker").get(0), "host0:1234");
  assertEquals(config.getCluster().get("worker").get(1), "host1:1234");
  assertEquals(config.getCluster().get("ps").get(0), "host2:1234");
}