Coverage Summary for Class: PlayerActionFeedback (it.polimi.ingsw.Server.Messages.ServerResponses)

Class Class, % Method, % Line, %
PlayerActionFeedback 0% (0/1) 0% (0/4) 0% (0/5)


1 package it.polimi.ingsw.Server.Messages.ServerResponses; 2  3 import it.polimi.ingsw.Server.Messages.ServerResponses.SupportStructures.StatusCode; 4  5 import java.io.Serial; 6  7 /** 8  * A {@link Response} to represent the output the controller gave on a previous {@link it.polimi.ingsw.Server.Messages.Events.Requests.PlayerActionRequest} 9  */ 10 public class PlayerActionFeedback extends Response { 11  @Serial 12  private static final long serialVersionUID = 312L; 13  14  private final String report; 15  16  /** 17  * Construct the response 18  * 19  * @param statusCode the status code of the response 20  * @param report additional feedback about the response 21  */ 22  private PlayerActionFeedback(StatusCode statusCode, String report) { 23  super(statusCode); 24  this.report = report; 25  } 26  27  /** 28  * Returns a failed status code response 29  * 30  * @param report additional feedback about failure 31  * @return a failed status code response 32  */ 33  public static PlayerActionFeedback fail(String report) { 34  return new PlayerActionFeedback(StatusCode.Fail, report); 35  } 36  37  /** 38  * Returns a successful status code response 39  * 40  * @return a successful status code response 41  */ 42  public static PlayerActionFeedback success() { 43  return new PlayerActionFeedback(StatusCode.Success, "Action executed successfully"); 44  } 45  46  /** 47  * Get information about the response 48  * 49  * @return additional feedback about the response 50  */ 51  public String getReport() { 52  return report; 53  } 54 }