@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Invalid disk value: -10") public void automaticHardwareIdSpecBuilderWrongDiskTest() { AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(2.0, 2048, Optional.of(-10.0f)); }
public static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); if (cores <= 0 || ram == 0) { throw new IllegalArgumentException(String.format("Omitted or wrong minCores and minRam. If you want to" + " use exact values, please set the minCores and minRam values: cores=%s, ram=%s", cores, ram)); } if (disk.isPresent() && disk.get() <= 0.0f) { throw new IllegalArgumentException(String.format("Invalid disk value: %.0f", disk.get())); } spec.disk = disk; spec.cores = cores; spec.ram = ram; return spec; }
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); if (cores <= 0 || ram == 0) { throw new IllegalArgumentException(String.format("Omitted or wrong minCores and minRam. If you want to" + " use exact values, please set the minCores and minRam values: cores=%s, ram=%s", cores, ram)); } if (disk.isPresent() && disk.get() <= 0.0f) { throw new IllegalArgumentException(String.format("Invalid disk value: %.0f", disk.get())); } spec.disk = disk; spec.cores = cores; spec.ram = ram; return spec; } }
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); if (cores <= 0 || ram == 0) { throw new IllegalArgumentException(String.format("Omitted or wrong minCores and minRam. If you want to" + " use exact values, please set the minCores and minRam values: cores=%s, ram=%s", cores, ram)); } if (disk.isPresent() && disk.get() <= 0.0f) { throw new IllegalArgumentException(String.format("Invalid disk value: %.0f", disk.get())); } spec.disk = disk; spec.cores = cores; spec.ram = ram; return spec; }  }
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); if (cores <= 0 || ram == 0) { throw new IllegalArgumentException(String.format("Omitted or wrong minCores and minRam. If you want to" + " use exact values, please set the minCores and minRam values: cores=%s, ram=%s", cores, ram)); } if (disk.isPresent() && disk.get() <= 0.0f) { throw new IllegalArgumentException(String.format("Invalid disk value: %.0f", disk.get())); } spec.disk = disk; spec.cores = cores; spec.ram = ram; return spec; }  static boolean isAutomaticId(String id); static AutomaticHardwareIdSpec parseId(String hardwareId); static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk); @Override String toString(); double getCores(); int getRam(); Optional<Float> getDisk(); }
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); if (cores <= 0 || ram == 0) { throw new IllegalArgumentException(String.format("Omitted or wrong minCores and minRam. If you want to" + " use exact values, please set the minCores and minRam values: cores=%s, ram=%s", cores, ram)); } if (disk.isPresent() && disk.get() <= 0.0f) { throw new IllegalArgumentException(String.format("Invalid disk value: %.0f", disk.get())); } spec.disk = disk; spec.cores = cores; spec.ram = ram; return spec; }  static boolean isAutomaticId(String id); static AutomaticHardwareIdSpec parseId(String hardwareId); static AutomaticHardwareIdSpec automaticHardwareIdSpecBuilder(double cores, int ram, Optional<Float> disk); @Override String toString(); double getCores(); int getRam(); Optional<Float> getDisk();  }