Fixed assertion from equals to compare on Id.

This commit is contained in:
Mattias Holmqvist 2011-11-24 23:17:41 +01:00
parent e6c13a4f32
commit 46301c800e
1 changed files with 17 additions and 1 deletions

View File

@ -20,7 +20,9 @@
package org.jclouds.virtualbox.functions;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.in;
import static com.google.common.collect.Iterables.any;
import static com.google.common.collect.Iterables.transform;
import static org.jclouds.virtualbox.experiment.TestUtils.computeServiceForLocalhostAndGuest;
import static org.testng.Assert.assertTrue;
@ -28,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
@ -52,6 +55,8 @@ import org.virtualbox_4_1.VirtualBoxManager;
import com.google.inject.Guice;
import javax.annotation.Nullable;
/**
* @author Andrea Turli, Mattias Holmqvist
*/
@ -96,9 +101,20 @@ public class IsoToIMachineLiveTest extends BaseVirtualBoxClientLiveTest {
// TODO add the description to the cache of the images or serialize to
// YAML the image desc
Set<? extends Image> images = context.getComputeService().listImages();
Iterable<String> imageIds = transform(images, extractId());
assertTrue(any(images, equalTo(newImage)));
assertTrue(any(imageIds, equalTo(newImage.getId())));
}
private Function<Image, String> extractId() {
return new Function<Image, String>() {
@Override
public String apply(@Nullable Image input) {
return input.getId();
}
};
}
}