### Question:
Observation implements Serializable { public static Observation from(Sc2Api.Observation sc2ApiObservation) { require("sc2api observation", sc2ApiObservation); return new Observation(sc2ApiObservation); } private  Observation(Sc2Api.Observation sc2ApiObservation); static Observation from(Sc2Api.Observation sc2ApiObservation); int getGameLoop(); PlayerCommon getPlayerCommon(); Set<Alert> getAlerts(); Set<AvailableAbility> getAvailableAbilities(); Optional<Score> getScore(); Optional<ObservationRaw> getRaw(); Optional<ObservationFeatureLayer> getFeatureLayer(); Optional<ObservationRender> getRender(); Optional<ObservationUi> getUi(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void throwsExceptionWhenSc2ApiObservationIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Observation.from(nothing())) .withMessage("sc2api observation is required"); }
@Test void convertsAllFieldsFromSc2ApiObservation() { assertThatAllFieldsAreConverted(Observation.from(sc2ApiObservation())); }
@Test void throwsExceptionWhenGameLoopIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Observation.from(without( () -> sc2ApiObservation().toBuilder(), Sc2Api.Observation.Builder::clearGameLoop).build())) .withMessage("game loop is required"); }
@Test void throwsExceptionWhenPlayerCommonIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Observation.from(without( () -> sc2ApiObservation().toBuilder(), Sc2Api.Observation.Builder::clearPlayerCommon).build())) .withMessage("player common is required"); }
@Test void throwsExceptionWhenOneOfInterfacesNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Observation.from(without( () -> sc2ApiObservation().toBuilder(), Sc2Api.Observation.Builder::clearRawData, Sc2Api.Observation.Builder::clearFeatureLayerData, Sc2Api.Observation.Builder::clearRenderData).build())) .withMessage("one of interfaces is required"); }
@Test void fulfillsEqualsContract() throws UnsupportedEncodingException { EqualsVerifier .forClass(Observation.class) .withNonnullFields("playerCommon", "alerts", "availableAbilities") .withPrefabValues(UnitInfo.class, UnitInfo.from(sc2ApiUnitInfoAddOn()), UnitInfo.from(sc2ApiUnitInfo())) .withPrefabValues( ByteString.class, ByteString.copyFrom("test", "UTF-8"), ByteString.copyFrom("test2", "UTF-8")) .verify(); }