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

Class Class, % Method, % Line, %
GameInit 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 a {@link it.polimi.ingsw.Server.Messages.Events.Requests.StartGameRequest} 9  */ 10 public class GameInit extends Response { 11  @Serial 12  private static final long serialVersionUID = 305L; 13  private final String errorMessage; 14  15  /** 16  * Construct the response 17  * 18  * @param statusCode the status code of the response 19  * @param errorMessage additional feedback about the response 20  */ 21  private GameInit(StatusCode statusCode, String errorMessage) { 22  super(statusCode); 23  this.errorMessage = errorMessage; 24  } 25  26  /** 27  * Returns a failed status code response 28  * 29  * @param errorMessage additional feedback about failure 30  * @return a failed status code response 31  */ 32  public static GameInit fail(String errorMessage) { 33  return new GameInit(StatusCode.Fail, errorMessage); 34  } 35  36  /** 37  * Returns a successful status code response 38  * 39  * @return a successful status code response 40  */ 41  public static GameInit success() { 42  return new GameInit(StatusCode.Success, null); 43  } 44  45  /** 46  * Get information about the response 47  * 48  * @return additional feedback about the response 49  */ 50  public String getErrorMessage() { 51  return errorMessage; 52  } 53 }