### Question:
AutomaticHardwareIdSpec { public static AutomaticHardwareIdSpec parseId(String hardwareId) { AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec(); String hardwareSpec = hardwareId.substring(10); Map<String, String> specValues = Splitter.on(';') .trimResults() .omitEmptyStrings() .withKeyValueSeparator('=') .split(hardwareSpec); if (!specValues.containsKey("ram") || !specValues.containsKey("cores")) { throw new IllegalArgumentException(String.format("Omitted keys on hardwareId: %s. Please set number " + "of cores and ram amount.", hardwareId)); } if (specValues.containsKey("disk")) { float disk = Float.parseFloat(specValues.get("disk")); if (disk > 0.0f) { spec.disk = Optional.of(disk); } else { throw new IllegalArgumentException(String.format("Invalid disk value: %s", hardwareId)); } } spec.ram = Integer.parseInt(specValues.get("ram")); spec.cores = Double.parseDouble(specValues.get("cores")); 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(expectedExceptions = IllegalArgumentException.class) public void parseAutomaticIdMissingValuesTest() { AutomaticHardwareIdSpec.parseId("automatic:cores=2"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Invalid disk value: automatic:cores=2;ram=4096;disk=-100") public void parseAutomaticIdInvalidDiskTest() { AutomaticHardwareIdSpec.parseId("automatic:cores=2;ram=4096;disk=-100"); }