### Question:
UpgradeData implements Serializable { public static UpgradeData from(Data.UpgradeData sc2ApiUpgradeData) { require("sc2api upgrade data", sc2ApiUpgradeData); return new UpgradeData(sc2ApiUpgradeData); } private  UpgradeData(Data.UpgradeData sc2ApiUpgradeData); static UpgradeData from(Data.UpgradeData sc2ApiUpgradeData); Upgrade getUpgrade(); String getName(); Optional<Integer> getMineralCost(); Optional<Integer> getVespeneCost(); Optional<Float> getResearchTime(); Optional<Ability> getAbility(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiUpgradeDataIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> UpgradeData.from(nothing())) .withMessage("sc2api upgrade data is required"); }
@Test void convertsAllFieldsFromSc2ApiUnit() { assertThatAllFieldsAreConverted(UpgradeData.from(sc2ApiUpgradeData())); }
@Test void throwsExceptionWhenUpgradeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> UpgradeData.from(without( () -> sc2ApiUpgradeData().toBuilder(), Data.UpgradeData.Builder::clearUpgradeId).build())) .withMessage("upgrade is required"); }
@Test void throwsExceptionWhenNameIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> UpgradeData.from(without( () -> sc2ApiUpgradeData().toBuilder(), Data.UpgradeData.Builder::clearName).build())) .withMessage("name is required"); }