### Question:
ResponseObservation extends Response { public static ResponseObservation from(Sc2Api.Response sc2ApiResponse) { if (!hasObservationResponse(sc2ApiResponse)) { throw new IllegalArgumentException("provided argument doesn't have observation response"); } return new ResponseObservation( sc2ApiResponse.getObservation(), sc2ApiResponse.getStatus(), sc2ApiResponse.getId()); } private  ResponseObservation(Sc2Api.ResponseObservation sc2ApiResponseObservation, Sc2Api.Status status, int id); static ResponseObservation from(Sc2Api.Response sc2ApiResponse); List<Action> getActions(); List<ActionError> getActionErrors(); Observation getObservation(); List<PlayerResult> getPlayerResults(); List<ChatReceived> getChat(); @Override boolean equals(Object o); @Override boolean canEqual(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiResponseDoesNotHaveObservation() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseObservation.from(nothing())) .withMessage("provided argument doesn't have observation response"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseObservation.from(aSc2ApiResponse().build())) .withMessage("provided argument doesn't have observation response"); }
@Test void convertsSc2ApiResponseObservationToResponseObservation() { ResponseObservation responseObservation = ResponseObservation.from(sc2ApiResponseWithObservation()); assertThatResponseIsInValidState(responseObservation); assertThatAllFieldsAreConverted(responseObservation); }
@Test void throwsExceptionWhenObservationDoesNotExist() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ResponseObservation.from(emptySc2ApiResponseObservation())) .withMessage("observation is required"); }
@Test void fulfillsEqualsContract() throws UnsupportedEncodingException { EqualsVerifier.forClass(ResponseObservation.class) .withIgnoredFields("nanoTime") .withNonnullFields("type", "status", "actions", "actionErrors", "observation", "playerResults", "chat") .withRedefinedSuperclass() .withPrefabValues(UnitInfo.class, UnitInfo.from(sc2ApiUnitInfoAddOn()), UnitInfo.from(sc2ApiUnitInfo())) .withPrefabValues( ByteString.class, ByteString.copyFrom("test", "UTF-8"), ByteString.copyFrom("test2", "UTF-8")) .verify(); }