### Question:
PassengerUnit implements Serializable { public static PassengerUnit from(Raw.PassengerUnit sc2ApiPassengerUnit) { require("sc2api passenger unit", sc2ApiPassengerUnit); return new PassengerUnit(sc2ApiPassengerUnit); } private  PassengerUnit(Raw.PassengerUnit sc2ApiPassengerUnit); static PassengerUnit from(Raw.PassengerUnit sc2ApiPassengerUnit); Tag getTag(); float getHealth(); float getHealthMax(); Optional<Float> getShield(); Optional<Float> getShieldMax(); Optional<Float> getEnergy(); Optional<Float> getEnergyMax(); UnitType getType(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiPassengerUnitIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PassengerUnit.from(nothing())) .withMessage("sc2api passenger unit is required"); }
@Test void convertsAllFieldsFromSc2ApiPassengerUnit() { assertThatAllFieldsAreConverted(PassengerUnit.from(sc2ApiPassengerUnit())); }
@Test void throwsExceptionWhenTagIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PassengerUnit.from( without(() -> sc2ApiPassengerUnit().toBuilder(), Raw.PassengerUnit.Builder::clearTag).build())) .withMessage("tag is required"); }
@Test void throwsExceptionWhenHealthIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PassengerUnit.from( without(() -> sc2ApiPassengerUnit().toBuilder(), Raw.PassengerUnit.Builder::clearHealth) .build())) .withMessage("health is required"); }
@Test void throwsExceptionWhenHealthMaxIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PassengerUnit.from( without(() -> sc2ApiPassengerUnit().toBuilder(), Raw.PassengerUnit.Builder::clearHealthMax) .build())) .withMessage("health max is required"); }
@Test void throwsExceptionWhenTypeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PassengerUnit.from( without(() -> sc2ApiPassengerUnit().toBuilder(), Raw.PassengerUnit.Builder::clearUnitType) .build())) .withMessage("unit type is required"); }