public void testCreateExtraSpecs() {
   if (apiOption.isPresent()) {
     FlavorExtraSpecsApi api = apiOption.get();
     testFlavor = Iterables.getLast(flavorApi.listFlavors());
     Map<String, String> before = api.getAllExtraSpecs(testFlavor.getId());
     assertNotNull(before);
     Map<String, String> specs = Maps.newHashMap(before);
     specs.putAll(testSpecs);
     assertTrue(api.setAllExtraSpecs(testFlavor.getId(), specs));
     assertEquals(api.getAllExtraSpecs(testFlavor.getId()), specs);
     for (Map.Entry<String, String> entry : specs.entrySet()) {
       assertEquals(api.getExtraSpec(testFlavor.getId(), entry.getKey()), entry.getValue());
     }
   }
 }
 @Test(dependsOnMethods = "testCreateExtraSpecs")
 public void testListExtraSpecs() {
   if (apiOption.isPresent()) {
     FlavorExtraSpecsApi api = apiOption.get();
     for (String key : testSpecs.keySet()) {
       assertTrue(api.getAllExtraSpecs(testFlavor.getId()).containsKey(key));
     }
     for (Resource flavor : flavorApi.listFlavors()) {
       Map<String, String> specs = api.getAllExtraSpecs(flavor.getId());
       assertNotNull(specs);
       for (Map.Entry<String, String> entry : specs.entrySet()) {
         assertEquals(api.getExtraSpec(flavor.getId(), entry.getKey()), entry.getValue());
       }
     }
   }
 }