### Question:
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();  }### Answer:
@Test public void automaticHardwareIdSpecBuilderTest() { AutomaticHardwareIdSpec spec = AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(2.0, 2048, Optional.<Float>absent()); assertThat(spec.getCores()).isEqualTo(2.0); assertThat(spec.getRam()).isEqualTo(2048); assertThat(spec.toString()).isEqualTo("automatic:cores=2.0;ram=2048"); AutomaticHardwareIdSpec spec2 = AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(4.0, 4096, Optional.of(10.0f)); assertThat(spec2.getCores()).isEqualTo(4.0); assertThat(spec2.getRam()).isEqualTo(4096); assertThat(spec2.getDisk().get()).isEqualTo(10); assertThat(spec2.toString()).isEqualTo("automatic:cores=4.0;ram=4096;disk=10"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Omitted or wrong minCores and minRam. If you want to" + " use exact values, please set the minCores and minRam values: cores=2.0, ram=0") public void automaticHardwareIdSpecBuilderWrongSpecsTest() { AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(2.0, 0, Optional.<Float>absent()); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Invalid disk value: -10") public void automaticHardwareIdSpecBuilderWrongDiskTest() { AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(2.0, 2048, Optional.of(-10.0f)); }