### Question:
ResponseRestartGame extends Response { public static ResponseRestartGame from(Sc2Api.Response sc2ApiResponse) { if (!hasRestartGameResponse(sc2ApiResponse)) { throw new IllegalArgumentException("provided argument doesn't have restart game response"); } return new ResponseRestartGame( sc2ApiResponse.getRestartGame(), sc2ApiResponse.getStatus(), sc2ApiResponse.getId()); } private  ResponseRestartGame(
            Sc2Api.ResponseRestartGame sc2ApiResponseRestartGame, Sc2Api.Status sc2ApiStatus, int id); static ResponseRestartGame from(Sc2Api.Response sc2ApiResponse); Optional<Error> getError(); Optional<String> getErrorDetails(); Optional<Boolean> getNeedHardReset(); @Override boolean equals(Object o); @Override boolean canEqual(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHaveRestartGame() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseRestartGame.from(nothing())) .withMessage("provided argument doesn't have restart game response"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseRestartGame.from(aSc2ApiResponse().build())) .withMessage("provided argument doesn't have restart game response"); }
@Test void convertsSc2ApiResponseRestartGameToResponseRestartGame() { ResponseRestartGame responseRestartGame = ResponseRestartGame.from(sc2ApiResponseWithRestartGame()); assertThatResponseDoesNotHaveError(responseRestartGame); assertThatResponseIsInValidState(responseRestartGame); }
@Test void throwsExceptionWhenResponseRestartGameErrorIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseRestartGame.Error.from(nothing())) .withMessage("sc2api response restart game error is required"); }
@Test void convertsSc2ApiResponseRestartGameWithErrorToResponseRestartGame() { ResponseRestartGame responseRestartGame = ResponseRestartGame.from(sc2ApiResponseWithRestartGameWithError()); assertThatResponseIsInValidState(responseRestartGame); assertThatErrorsAreMapped(responseRestartGame); }