> +      TemplateBuilder defaultTemplate = createMock(TemplateBuilder.class);
> +      TemplateOptions defaultOptions = createMock(TemplateOptions.class);
> +      GetImageStrategy getImageStrategy = createMock(GetImageStrategy.class);
> +
> +      expect(optionsProvider.get()).andReturn(new TemplateOptions());
> +      
> expect(getImageStrategy.getImage(anyObject(String.class))).andReturn(null);
> +      replay(defaultTemplate, optionsProvider, templateBuilderProvider, 
> getImageStrategy);
> +      TemplateBuilderImpl templateBuilder = new 
> ArbitraryCpuRamTemplateBuilderImpl(locations, new ImageCacheSupplier(images, 
> 60,
> +            Atomics.<AuthorizationException>newReference(), 
> Providers.of(getImageStrategy)), hardwares,
> +            Suppliers.ofInstance(region), optionsProvider, 
> templateBuilderProvider);
> +      templateBuilder.minRam(1024);
> +      templateBuilder.minCores(2);
> +      Hardware hardware = templateBuilder.build().getHardware();
> +      assertThat(hardware.getRam()).isEqualTo(1024);
> +      
> assertThat(hardware.getProcessors()).extracting("cores").containsExactly(2.0);
> +   }

Add a test to verify what happens when you only set the minRam or the minCores, 
as it is a path that your class is explicitly handling.
Also add a couple more tests where there is actually a hardware profile present:

* One test where the existing hardware profile does not match, and an automatic 
one is used.
* One test where the existing hardware profile matches the given cpu and ram, 
to verify that the existing hardware profile is used.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/984/files/5e38477f80df5dd0dce54f7773cf9e883fbf3d2d#r71279447

Reply via email to