### Question:
ResponseSaveMap extends Response { public static ResponseSaveMap from(Sc2Api.Response sc2ApiResponse) { if (!hasSaveMapResponse(sc2ApiResponse)) { throw new IllegalArgumentException("provided argument doesn't have save map response"); } return new ResponseSaveMap(sc2ApiResponse.getSaveMap(), sc2ApiResponse.getStatus(), sc2ApiResponse.getId()); } private  ResponseSaveMap(Sc2Api.ResponseSaveMap sc2ApiResponseSaveMap, Sc2Api.Status sc2ApiStatus, int id); static ResponseSaveMap from(Sc2Api.Response sc2ApiResponse); Optional<Error> getError(); @Override boolean equals(Object o); @Override boolean canEqual(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHaveSaveMap() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseSaveMap.from(nothing())) .withMessage("provided argument doesn't have save map response"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseSaveMap.from(aSc2ApiResponse().build())) .withMessage("provided argument doesn't have save map response"); }
@Test void convertsSc2ApiResponseSaveMapToResponseSaveMap() { ResponseSaveMap responseSaveMap = ResponseSaveMap.from(sc2ApiResponseWithSaveMap()); assertThatResponseDoesNotHaveError(responseSaveMap); assertThatResponseIsInValidState(responseSaveMap); }
@Test void throwsExceptionWhenResponseSaveMapErrorIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseSaveMap.Error.from(nothing())) .withMessage("sc2api response save map error is required"); }
@Test void convertsSc2ApiResponseSaveMapWithErrorToResponseSaveMap() { ResponseSaveMap responseSaveMap = ResponseSaveMap.from(sc2ApiResponseWithSaveMapWithError()); assertThatResponseIsInValidState(responseSaveMap); assertThatErrorIsMapped(responseSaveMap); }