### Question:
ResponseLeaveGame extends Response { public static ResponseLeaveGame from(Sc2Api.Response sc2ApiResponse) { if (!hasLeaveGameResponse(sc2ApiResponse)) { throw new IllegalArgumentException("provided argument doesn't have leave game response"); } return new ResponseLeaveGame(sc2ApiResponse.getStatus(), sc2ApiResponse.getId()); } private  ResponseLeaveGame(Sc2Api.Status sc2ApiStatus, int id); static ResponseLeaveGame from(Sc2Api.Response sc2ApiResponse); @Override boolean equals(Object o); @Override boolean canEqual(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHaveLeaveGame() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseLeaveGame.from(nothing())) .withMessage("provided argument doesn't have leave game response"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseLeaveGame.from(aSc2ApiResponse().build())) .withMessage("provided argument doesn't have leave game response"); }
@Test void convertsSc2ApiResponseLeaveGameToResponseLeaveGame() { ResponseLeaveGame responseLeaveGame = ResponseLeaveGame.from(sc2ApiResponseWithLeaveGame()); assertThat(responseLeaveGame).as("converted response leave game").isNotNull(); assertThat(responseLeaveGame.getType()).as("type of leave game response").isEqualTo(ResponseType.LEAVE_GAME); assertThat(responseLeaveGame.getStatus()).as("status of leave game response").isEqualTo(GameStatus.LAUNCHED); }