public void testCreateMachine() {
    Machine newMachine =
        api.createWithDataset(
            datasetURN, CreateMachineOptions.Builder.metadata(ImmutableMap.of("foo", "bar")));
    machine = newMachine;
    name = newMachine.getName();

    assertEquals(newMachine.getMetadata().get("foo").toString(), "bar");
    assertTrue(
        newMachine.getMetadata().get(Metadata.ROOT_AUTHORIZED_KEYS.key()).indexOf(key.get("public"))
            != -1,
        newMachine + "; key: " + key.get("public"));

    assertTrue(machineRunning.apply(newMachine), newMachine.toString());
    machine = api.get(newMachine.getId());
  }
 @Test(dependsOnMethods = "testCreateMachine", expectedExceptions = IllegalStateException.class)
 public void testDuplicateMachineThrowsIllegalStateException() {
   api.createWithDataset(datasetURN, CreateMachineOptions.Builder.name(name));
 }