test_class.declarator: ENTITY_VALUE = "entityValue"
test_class.modifier: private static final
test_class.original_string: private static final String ENTITY_VALUE = "entityValue";
test_class.type: String
test_class.var_name: ENTITY_VALUE
test_class.declarator: ENTITY_JSON_VALUE = "\"" + ENTITY_VALUE + "\""
test_class.modifier: private static final
test_class.original_string: private static final String ENTITY_JSON_VALUE = "\"" + ENTITY_VALUE + "\"";
test_class.type: String
test_class.var_name: ENTITY_JSON_VALUE
test_class.file: bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/JSONResponseTest.java
test_class.identifier: JSONResponseTest
test_case.body: @Test
      public void createMessageWithErrorStatusShouldCreateErrorResponse() {
          Response errorResponse = JSONResponse.createResponse(Status.INTERNAL_SERVER_ERROR, null, "error");
  
          assertThat(errorResponse.getMediaType(), is(equalTo(MediaType.APPLICATION_JSON_TYPE)));
          assertThat(errorResponse.getStatus(), is(500));
  
          JsonObject entity = ((JsonObject) errorResponse.getEntity()).get(JSONResponse.JSON_KEY_ERROR).getAsJsonObject();
          assertThat(entity.get(JSONResponse.JSON_KEY_ERROR_MESSAGE).getAsString(), is("error"));
          assertThat(entity.get(JSONResponse.JSON_KEY_HTTPCODE).getAsInt(), is(500));
          assertThat(entity.get(JSONResponse.JSON_KEY_ENTITY), is(nullValue()));
      }
test_case.class_method_signature: JSONResponseTest.createMessageWithErrorStatusShouldCreateErrorResponse()
test_case.full_signature: @Test public void createMessageWithErrorStatusShouldCreateErrorResponse()
test_case.identifier: createMessageWithErrorStatusShouldCreateErrorResponse
test_case.invocations: createResponse assertThat getMediaType is equalTo assertThat getStatus is getAsJsonObject get getEntity assertThat getAsString get is assertThat getAsInt get is assertThat get is nullValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createMessageWithErrorStatusShouldCreateErrorResponse()
focal_class.declarator: logger = LoggerFactory.getLogger(JSONResponse.class)
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(JSONResponse.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: INSTANCE = new JSONResponse()
focal_class.modifier: private static final
focal_class.original_string: private static final JSONResponse INSTANCE = new JSONResponse();
focal_class.type: JSONResponse
focal_class.var_name: INSTANCE
focal_class.declarator: gson = new GsonBuilder().setDateFormat(DateTimeType.DATE_PATTERN_WITH_TZ_AND_MS).create()
focal_class.modifier: private final
focal_class.original_string: private final Gson gson = new GsonBuilder().setDateFormat(DateTimeType.DATE_PATTERN_WITH_TZ_AND_MS).create();
focal_class.type: Gson
focal_class.var_name: gson
focal_class.declarator: JSON_KEY_ERROR_MESSAGE = "message"
focal_class.modifier: static final
focal_class.original_string: static final String JSON_KEY_ERROR_MESSAGE = "message";
focal_class.type: String
focal_class.var_name: JSON_KEY_ERROR_MESSAGE
focal_class.declarator: JSON_KEY_ERROR = "error"
focal_class.modifier: static final
focal_class.original_string: static final String JSON_KEY_ERROR = "error";
focal_class.type: String
focal_class.var_name: JSON_KEY_ERROR
focal_class.declarator: JSON_KEY_HTTPCODE = "http-code"
focal_class.modifier: static final
focal_class.original_string: static final String JSON_KEY_HTTPCODE = "http-code";
focal_class.type: String
focal_class.var_name: JSON_KEY_HTTPCODE
focal_class.declarator: JSON_KEY_ENTITY = "entity"
focal_class.modifier: static final
focal_class.original_string: static final String JSON_KEY_ENTITY = "entity";
focal_class.type: String
focal_class.var_name: JSON_KEY_ENTITY
focal_class.file: bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/JSONResponse.java
focal_class.identifier: JSONResponse
focal_class.class_method_signature: JSONResponse.JSONResponse()
focal_class.full_signature: private  JSONResponse()
focal_class.identifier: JSONResponse
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  JSONResponse()
focal_class.class_method_signature: JSONResponse.createErrorResponse(Response.StatusType status, String errormessage)
focal_class.full_signature: public static Response createErrorResponse(Response.StatusType status, String errormessage)
focal_class.identifier: createErrorResponse
focal_class.modifiers: public static
focal_class.parameters: (Response.StatusType status, String errormessage)
focal_class.return: Response
focal_class.signature: Response createErrorResponse(Response.StatusType status, String errormessage)
focal_class.class_method_signature: JSONResponse.createResponse(Response.StatusType status, Object entity, String errormessage)
focal_class.full_signature: public static Response createResponse(Response.StatusType status, Object entity, String errormessage)
focal_class.identifier: createResponse
focal_class.modifiers: public static
focal_class.parameters: (Response.StatusType status, Object entity, String errormessage)
focal_class.return: Response
focal_class.signature: Response createResponse(Response.StatusType status, Object entity, String errormessage)
focal_class.class_method_signature: JSONResponse.responseBuilder(Response.StatusType status)
focal_class.full_signature: private ResponseBuilder responseBuilder(Response.StatusType status)
focal_class.identifier: responseBuilder
focal_class.modifiers: private
focal_class.parameters: (Response.StatusType status)
focal_class.return: ResponseBuilder
focal_class.signature: ResponseBuilder responseBuilder(Response.StatusType status)
focal_class.class_method_signature: JSONResponse.createErrorJson(String message, Response.StatusType status, Object entity, Exception ex)
focal_class.full_signature: private JsonElement createErrorJson(String message, Response.StatusType status, Object entity, Exception ex)
focal_class.identifier: createErrorJson
focal_class.modifiers: private
focal_class.parameters: (String message, Response.StatusType status, Object entity, Exception ex)
focal_class.return: JsonElement
focal_class.signature: JsonElement createErrorJson(String message, Response.StatusType status, Object entity, Exception ex)
focal_class.class_method_signature: JSONResponse.createErrorResponse(Response.StatusType status, Object entity, String errormessage)
focal_class.full_signature: private Response createErrorResponse(Response.StatusType status, Object entity, String errormessage)
focal_class.identifier: createErrorResponse
focal_class.modifiers: private
focal_class.parameters: (Response.StatusType status, Object entity, String errormessage)
focal_class.return: Response
focal_class.signature: Response createErrorResponse(Response.StatusType status, Object entity, String errormessage)
focal_class.class_method_signature: JSONResponse.createResponse(Response.StatusType status, final Object entity)
focal_class.full_signature: private Response createResponse(Response.StatusType status, final Object entity)
focal_class.identifier: createResponse
focal_class.modifiers: private
focal_class.parameters: (Response.StatusType status, final Object entity)
focal_class.return: Response
focal_class.signature: Response createResponse(Response.StatusType status, final Object entity)
focal_method.body: public static Response createResponse(Response.StatusType status, Object entity, String errormessage) {
          if (status.getFamily() != Response.Status.Family.SUCCESSFUL) {
              return INSTANCE.createErrorResponse(status, entity, errormessage);
          }
  
          return INSTANCE.createResponse(status, entity);
      }
focal_method.class_method_signature: JSONResponse.createResponse(Response.StatusType status, Object entity, String errormessage)
focal_method.full_signature: public static Response createResponse(Response.StatusType status, Object entity, String errormessage)
focal_method.identifier: createResponse
focal_method.invocations: getFamily createErrorResponse createResponse
focal_method.modifiers: public static
focal_method.parameters: (Response.StatusType status, Object entity, String errormessage)
focal_method.return: Response
focal_method.signature: Response createResponse(Response.StatusType status, Object entity, String errormessage)