AutonomiccsSystemVirtualMachinesTemplateRegister implements InitializingBean { protected String getSupportedImageFormat(HypervisorType hypervisor) { ImageFormat supportedImageFormat = Hypervisor.HypervisorType.getSupportedImageFormat(hypervisor); if (supportedImageFormat != null) { return supportedImageFormat.name(); } throw new CloudRuntimeException(String.format("Could not find a supported image format for hypervisor [%s]", hypervisor)); }  @Scheduled(initialDelay = ONE_MINUTE_IN_MILLISECONDS, fixedDelay = ONE_MINUTE_IN_MILLISECONDS * NUMBER_OF_MINUTES_BETWEEN_REGISTRATION_OF_TEMPLATES) void registerTemplatesIfNeeded(); @Override void afterPropertiesSet();  }
@Test(expected = CloudRuntimeException.class) public void getSupportedImageFormatTestExpectCloudRuntimeException() { spy.getSupportedImageFormat(HypervisorType.Any); }
@Test public void getSupportedImageFormatTest() { String result = spy.getSupportedImageFormat(HypervisorType.XenServer); Assert.assertEquals("VHD", result); }