### Question:
PlayerCommon implements Serializable { public static PlayerCommon from(Sc2Api.PlayerCommon sc2ApiPlayerCommon) { require("sc2api player common", sc2ApiPlayerCommon); return new PlayerCommon(sc2ApiPlayerCommon); } private  PlayerCommon(Sc2Api.PlayerCommon sc2ApiPlayerCommon); static PlayerCommon from(Sc2Api.PlayerCommon sc2ApiPlayerCommon); int getPlayerId(); int getMinerals(); int getVespene(); int getFoodCap(); int getFoodUsed(); int getFoodArmy(); int getFoodWorkers(); int getIdleWorkerCount(); int getArmyCount(); Optional<Integer> getWarpGateCount(); Optional<Integer> getLarvaCount(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiPlayerCommonIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(nothing())) .withMessage("sc2api player common is required"); }
@Test void convertsAllFieldsFromSc2ApiPlayerCommon() { assertThatAllFieldsAreConverted(PlayerCommon.from(sc2ApiPlayerCommon())); }
@Test void throwsExceptionWhenPlayerIdIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearPlayerId).build())) .withMessage("player id is required"); }
@Test void throwsExceptionWhenMineralsIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearMinerals).build())) .withMessage("minerals is required"); }
@Test void throwsExceptionWhenVespeneIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearVespene).build())) .withMessage("vespene is required"); }
@Test void throwsExceptionWhenFoodCapIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearFoodCap).build())) .withMessage("food cap is required"); }
@Test void throwsExceptionWhenFoodUsedIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearFoodUsed).build())) .withMessage("food used is required"); }
@Test void throwsExceptionWhenFoodArmyIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearFoodArmy).build())) .withMessage("food army is required"); }
@Test void throwsExceptionWhenFoodWorkersIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearFoodWorkers).build())) .withMessage("food workers is required"); }
@Test void throwsExceptionWhenIdleWorkerCountIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearIdleWorkerCount).build())) .withMessage("idle worker count is required"); }
@Test void throwsExceptionWhenArmyCountIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerCommon.from(without( () -> sc2ApiPlayerCommon().toBuilder(), Sc2Api.PlayerCommon.Builder::clearArmyCount).build())) .withMessage("army count is required"); }