### Question:
CargoPanel implements Serializable { public static CargoPanel from(Ui.CargoPanel sc2ApiCargoPanel) { require("sc2api cargo panel", sc2ApiCargoPanel); return new CargoPanel(sc2ApiCargoPanel); } private  CargoPanel(Ui.CargoPanel sc2ApiCargoPanel); static CargoPanel from(Ui.CargoPanel sc2ApiCargoPanel); UnitInfo getUnit(); List<UnitInfo> getPassengers(); int getCargoSize(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiCargoPanelIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> CargoPanel.from(nothing())) .withMessage("sc2api cargo panel is required"); }
@Test void convertsAllFieldsFromSc2ApiCargoPanel() { assertThatAllFieldsAreConverted(CargoPanel.from(sc2ApiCargoPanel())); }
@Test void throwsExceptionWhenUnitIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> CargoPanel.from( without(() -> sc2ApiCargoPanel().toBuilder(), Ui.CargoPanel.Builder::clearUnit).build())) .withMessage("unit is required"); }
@Test void throwsExceptionWhenCargoSizeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> CargoPanel.from(without( () -> sc2ApiCargoPanel().toBuilder(), Ui.CargoPanel.Builder::clearSlotsAvailable).build())) .withMessage("cargo size is required"); }
@Test void fulfillsEqualsContract() { EqualsVerifier .forClass(CargoPanel.class) .withNonnullFields("unit", "passengers") .withPrefabValues(UnitInfo.class, UnitInfo.from(sc2ApiUnitInfoAddOn()), UnitInfo.from(sc2ApiUnitInfo())) .verify(); }