@Override
    public String toString() {
        try {
            return new ObjectMapper().configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
                .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true)
                .setSerializationInclusion(Include.NON_NULL).writeValueAsString(this);
        } catch (JsonProcessingException e) {
            return "AlertaMassage Object parsing error : " + e.getMessage();
        }
    }
@Test
  public void testAlertaMessageJsonFormatWithoutNullValues() {
    AlertaMessage alertaMessage = new AlertaMessage("resource", "event");

    String expectedJson =
        "{\"event\":\"event\","
        + "\"resource\":\"resource\"}";

    assertEquals(expectedJson, alertaMessage.toString());
  }