### Question:
ResponsePing extends Response { public static ResponsePing from(Sc2Api.Response sc2ApiResponse) { if (!hasPingResponse(sc2ApiResponse)) { throw new IllegalArgumentException("provided argument doesn't have ping response"); } return new ResponsePing(sc2ApiResponse.getPing(), sc2ApiResponse.getStatus(), sc2ApiResponse.getId()); } private  ResponsePing(Sc2Api.ResponsePing sc2ApiResponsePing, Sc2Api.Status sc2ApiStatus, int id); static ResponsePing from(Sc2Api.Response sc2ApiResponse); String getGameVersion(); String getDataVersion(); Integer getDataBuild(); Integer getBaseBuild(); @Override boolean equals(Object o); @Override boolean canEqual(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHavePing() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponsePing.from(nothing())) .withMessage("provided argument doesn't have ping response"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponsePing.from(aSc2ApiResponse().build())) .withMessage("provided argument doesn't have ping response"); }
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHaveAllFieldsSet() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponsePing.from( sc2ApiResponsePingWithout(Sc2Api.ResponsePing.Builder::clearGameVersion))) .withMessage("game version is required"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponsePing.from( sc2ApiResponsePingWithout(Sc2Api.ResponsePing.Builder::clearDataVersion))) .withMessage("data version is required"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponsePing.from( sc2ApiResponsePingWithout(Sc2Api.ResponsePing.Builder::clearBaseBuild))) .withMessage("base build is required"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponsePing.from( sc2ApiResponsePingWithout(Sc2Api.ResponsePing.Builder::clearDataBuild))) .withMessage("data build is required"); }
@Test void convertsSc2ApiResponsePingToResponsePing() { ResponsePing responsePing = ResponsePing.from(sc2ApiResponseWithPing()); assertThatAllFieldsAreProperlyConverted(responsePing); }