### Question:
InstanceMetaDataToCloudInstanceConverter extends AbstractConversionServiceAwareConverter<InstanceMetaData, CloudInstance> { @Override public CloudInstance convert(InstanceMetaData metaDataEntity) { InstanceGroup group = metaDataEntity.getInstanceGroup(); Template template = group.getTemplate(); Stack stack = group.getStack(); StackAuthentication stackAuthentication = stack.getStackAuthentication(); InstanceStatus status = getInstanceStatus(metaDataEntity); String imageId = instanceMetadataToImageIdConverter.convert(metaDataEntity); InstanceTemplate instanceTemplate = stackToCloudStackConverter.buildInstanceTemplate(template, group.getGroupName(), metaDataEntity.getPrivateId(), status, imageId); InstanceAuthentication instanceAuthentication = new InstanceAuthentication( stackAuthentication.getPublicKey(), stackAuthentication.getPublicKeyId(), stackAuthentication.getLoginUserName()); Map<String, Object> params = new HashMap<>(); params.put(CloudInstance.SUBNET_ID, metaDataEntity.getSubnetId()); params.put(CloudInstance.INSTANCE_NAME, metaDataEntity.getInstanceName()); Map<String, Object> cloudInstanceParameters = stackToCloudStackConverter.buildCloudInstanceParameters( stack.getEnvironmentCrn(), metaDataEntity, CloudPlatform.valueOf(stack.getCloudPlatform())); params.putAll(cloudInstanceParameters); return new CloudInstance(metaDataEntity.getInstanceId(), instanceTemplate, instanceAuthentication, params); }  @Override CloudInstance convert(InstanceMetaData metaDataEntity);  }### Answer:
@Test public void testConvert() { InstanceMetaData source = getSource(); Map<String, Object> params = new HashMap<>(); params.put(CloudInstance.SUBNET_ID, SUBNET_ID); params.put(CloudInstance.INSTANCE_NAME, INSTANCE_NAME); when(stackToCloudStackConverter.buildCloudInstanceParameters(any(), any(), any())).thenReturn(params); CloudInstance cloudInstance = underTest.convert(source); assertEquals(2, cloudInstance.getParameters().size()); assertEquals(source.getInstanceId(), cloudInstance.getInstanceId()); }