### Question:
UnitInfo implements Serializable { public static UnitInfo from(Ui.UnitInfo sc2ApiUnitInfo) { require("sc2api unit info", sc2ApiUnitInfo); return new UnitInfo(sc2ApiUnitInfo); } private  UnitInfo(Ui.UnitInfo sc2ApiUnitInfo); static UnitInfo from(Ui.UnitInfo sc2ApiUnitInfo); UnitType getUnitType(); Optional<Alliance> getPlayerRelative(); Optional<Integer> getHealth(); Optional<Integer> getShields(); Optional<Integer> getEnergy(); Optional<Integer> getTransportSlotsTaken(); Optional<Float> getBuildProgress(); Optional<UnitInfo> getAddOn(); Optional<Integer> getMaxHealth(); Optional<Integer> getMaxShields(); Optional<Integer> getMaxEnergy(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiUnitInfoIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> UnitInfo.from(nothing())) .withMessage("sc2api unit info is required"); }
@Test void convertsAllFieldsFromSc2ApiUnitInfo() { assertThatAllFieldsAreConverted(UnitInfo.from(sc2ApiUnitInfo())); }
@Test void throwsExceptionWhenUnitTypeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> UnitInfo.from( without(() -> sc2ApiUnitInfo().toBuilder(), Ui.UnitInfo.Builder::clearUnitType).build())) .withMessage("unit type is required"); }
@Test void fulfillsEqualsContract() { EqualsVerifier .forClass(UnitInfo.class) .withNonnullFields("unitType") .withPrefabValues(UnitInfo.class, UnitInfo.from(sc2ApiUnitInfoAddOn()), UnitInfo.from(sc2ApiUnitInfo())) .verify(); }