### Question:
ActionRaw implements Sc2ApiSerializable<Raw.ActionRaw>, GeneralizableAbility<ActionRaw> { @Override public ActionRaw generalizeAbility(UnaryOperator<Ability> generalize) { Optional<ActionRawUnitCommand> commandUnit = getUnitCommand(); Optional<ActionRawCameraMove> commandCamera = getCameraMove(); Optional<ActionRawToggleAutocast> commandAutocast = getToggleAutocast(); if (commandUnit.isPresent()) { return ActionRaw.of(commandUnit.get().generalizeAbility(generalize)); } if (commandCamera.isPresent()) { return this; } if (commandAutocast.isPresent()) { return ActionRaw.of(commandAutocast.get().generalizeAbility(generalize)); } throw new AssertionError("Invalid state: one of action case must be set."); } private  ActionRaw(Raw.ActionRaw sc2ApiActionRaw); private  ActionRaw(ActionRawUnitCommand unitCommand); private  ActionRaw(ActionRawCameraMove cameraMove); private  ActionRaw(ActionRawToggleAutocast toggleAutocast); static ActionRaw from(Raw.ActionRaw sc2ApiActionRaw); static ActionRaw of(ActionRawUnitCommand unitCommand); static ActionRaw of(ActionRawCameraMove cameraMove); static ActionRaw of(ActionRawToggleAutocast toggleAutocast); @Override Raw.ActionRaw toSc2Api(); Optional<ActionRawUnitCommand> getUnitCommand(); Optional<ActionRawCameraMove> getCameraMove(); Optional<ActionRawToggleAutocast> getToggleAutocast(); @Override ActionRaw generalizeAbility(UnaryOperator<Ability> generalize); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void createsCopyWithGeneralizedAbility() { ActionRaw actionRawWithCameraMove = actionRawWithCameraMove(); ActionRaw actionRawWithToggleAutocast = actionRawWithToggleAutocast(); ActionRaw actionRawWithUnitCommand = actionRawWithUnitCommand(); UnaryOperator<Ability> generalize = ability -> Abilities.ATTACK_REDIRECT; assertThat(actionRawWithCameraMove.generalizeAbility(generalize)).isSameAs(actionRawWithCameraMove); assertThat(actionRawWithToggleAutocast.generalizeAbility(generalize)).isNotEqualTo(actionRawWithToggleAutocast); assertThat(actionRawWithUnitCommand.generalizeAbility(generalize)).isNotEqualTo(actionRawWithUnitCommand); }