### Question:
ControlGroup implements Serializable { public static ControlGroup from(Ui.ControlGroup sc2ApiControlGroup) { require("sc2api control group", sc2ApiControlGroup); return new ControlGroup(sc2ApiControlGroup); } private  ControlGroup(Ui.ControlGroup sc2ApiControlGroup); static ControlGroup from(Ui.ControlGroup sc2ApiControlGroup); int getIndex(); UnitType getLeaderUnitType(); int getCount(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiControlGroupIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ControlGroup.from(nothing())) .withMessage("sc2api control group is required"); }
@Test void convertsSc2ApiControlGroupToControlGroup() { assertThatAllFieldsAreConverted(ControlGroup.from(sc2ApiControlGroup())); }
@Test void throwsExceptionWhenIndexIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ControlGroup.from(without( () -> sc2ApiControlGroup().toBuilder(), Ui.ControlGroup.Builder::clearControlGroupIndex).build())) .withMessage("index is required"); }
@Test void throwsExceptionWhenLeaderUnitTypeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ControlGroup.from(without( () -> sc2ApiControlGroup().toBuilder(), Ui.ControlGroup.Builder::clearLeaderUnitType).build())) .withMessage("leader unit type is required"); }
@Test void throwsExceptionWhenCountIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ControlGroup.from(without( () -> sc2ApiControlGroup().toBuilder(), Ui.ControlGroup.Builder::clearCount).build())) .withMessage("count is required"); }