### Question:
PlayerInfo implements Serializable { public static PlayerInfo from(Sc2Api.PlayerInfo sc2ApiPlayerInfo) { require("sc2api player info", sc2ApiPlayerInfo); return new PlayerInfo(sc2ApiPlayerInfo); } private  PlayerInfo(Sc2Api.PlayerInfo sc2ApiPlayerInfo); static PlayerInfo from(Sc2Api.PlayerInfo sc2ApiPlayerInfo); int getPlayerId(); Optional<PlayerType> getPlayerType(); Race getRequestedRace(); Optional<Race> getActualRace(); Optional<Difficulty> getDifficulty(); Optional<String> getPlayerName(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiPlayerInfoIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerInfo.from(nothing())) .withMessage("sc2api player info is required"); }
@Test void convertsAllFieldsFromSc2ApiPlayerInfo() { assertThatAllFieldsAreConverted(PlayerInfo.from(sc2ApiPlayerInfo())); }
@Test void throwsExceptionWhenSc2ApiPlayerIdDoesNotExist() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerInfo.from(sc2ApiPlayerInfoWithoutPlayerId())) .withMessage("player id is required"); }
@Test void throwsExceptionWhenSc2ApiRequestedRaceDoesNotExist() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> PlayerInfo.from(sc2ApiPlayerInfoWithoutRaceRequested())) .withMessage("requested race is required"); }