Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
.of(existingHardware);
Machine machineToConvert = new ParseCreatedMachineTest().expected();
MachineInDatacenter machineInDatacenterToConvert = new MachineInDatacenter(machineToConvert, "us-sw-1");
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
Suppliers.<Set<? extends Image>> ofInstance(images),
Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
NodeMetadata convertedNodeMetadata = converter.apply(machineInDatacenterToConvert);
assertEquals(machineInDatacenterToConvert.slashEncode(), convertedNodeMetadata.getId());
assertEquals(machineToConvert.getId(), convertedNodeMetadata.getProviderId());
assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.ZONE);
assertEquals(convertedNodeMetadata.getLocation().getId(), "us-sw-1");