### Question:
ResponseReplayInfo extends Response { public static ResponseReplayInfo from(Sc2Api.Response sc2ApiResponse) { if (!hasReplayInfoResponse(sc2ApiResponse)) { throw new IllegalArgumentException("provided argument doesn't have replay info response"); } return new ResponseReplayInfo( sc2ApiResponse.getReplayInfo(), sc2ApiResponse.getStatus(), sc2ApiResponse.getId()); } private  ResponseReplayInfo(
            Sc2Api.ResponseReplayInfo sc2ApiResponseReplayInfo, Sc2Api.Status sc2ApiStatus, int id); static ResponseReplayInfo from(Sc2Api.Response sc2ApiResponse); Optional<ResponseReplayInfo.Error> getError(); Optional<String> getErrorDetails(); Optional<ReplayInfo> getReplayInfo(); @Override boolean equals(Object o); @Override boolean canEqual(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHaveReplayInfo() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseReplayInfo.from(nothing())) .withMessage("provided argument doesn't have replay info response"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseReplayInfo.from(aSc2ApiResponse().build())) .withMessage("provided argument doesn't have replay info response"); }
@Test void convertsSc2ApiResponseReplayInfoToResponseReplayInfo() { ResponseReplayInfo responseReplayInfo = ResponseReplayInfo.from(sc2ApiResponseWithReplayInfo()); assertThatResponseDoesNotHaveError(responseReplayInfo); assertThatResponseIsInValidState(responseReplayInfo); }
@Test void throwsExceptionWhenMapInfoIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseReplayInfo.from(sc2ApiResponseReplayInfoWithoutMap())) .withMessage("map info (local or battlenet) is required"); }
@Test void throwsExceptionWhenResponseReplayInfoErrorIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseReplayInfo.Error.from(nothing())) .withMessage("sc2api response replay info error is required"); }
@Test void convertsSc2ApiResponseReplayInfoWithErrorToResponseReplayInfo() { ResponseReplayInfo responseReplayInfo = ResponseReplayInfo.from(sc2ApiResponseWithReplayInfoWithError()); assertThatResponseIsInValidState(responseReplayInfo); assertThatErrorsAreMapped(responseReplayInfo); }