### Question:
Weapon implements Serializable { public static Weapon from(Data.Weapon sc2ApiWeapon) { require("sc2api weapon", sc2ApiWeapon); return new Weapon(sc2ApiWeapon); } private  Weapon(Data.Weapon sc2ApiWeapon); static Weapon from(Data.Weapon sc2ApiWeapon); TargetType getTargetType(); float getDamage(); Set<DamageBonus> getDamageBonuses(); int getAttacks(); float getRange(); float getSpeed(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiWeaponIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.from(nothing())) .withMessage("sc2api weapon is required"); }
@Test void convertsAllFieldsFromSc2ApiWeapon() { assertThatAllFieldsAreConverted(Weapon.from(sc2ApiWeapon())); }
@Test void throwsExceptionWhenWeaponTargetTypeIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.TargetType.from(nothing())) .withMessage("sc2api target type is required"); }
@Test void throwsExceptionWhenTargetTypeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.from( without(() -> sc2ApiWeapon().toBuilder(), Data.Weapon.Builder::clearType).build())) .withMessage("target type is required"); }
@Test void throwsExceptionWhenDamageIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.from( without(() -> sc2ApiWeapon().toBuilder(), Data.Weapon.Builder::clearDamage).build())) .withMessage("damage is required"); }
@Test void throwsExceptionWhenAttacksIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.from( without(() -> sc2ApiWeapon().toBuilder(), Data.Weapon.Builder::clearAttacks).build())) .withMessage("attacks is required"); }
@Test void throwsExceptionWhenRangeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.from( without(() -> sc2ApiWeapon().toBuilder(), Data.Weapon.Builder::clearRange).build())) .withMessage("range is required"); }
@Test void throwsExceptionWhenSpeedIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Weapon.from( without(() -> sc2ApiWeapon().toBuilder(), Data.Weapon.Builder::clearSpeed).build())) .withMessage("speed is required"); }