@Override
    public ValueType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        if (p.currentTokenId() == JsonTokenId.ID_STRING) {
            final String str = StringUtils.upperCase(p.getText(), Locale.ROOT);
            try {
                return ValueType.valueOf(str);
            } catch (IllegalArgumentException e) {
                throw ctxt.weirdStringException(str, ValueType.class, e.getMessage());
            }
        } else {
            throw ctxt.wrongTokenException(p, handledType(), JsonToken.VALUE_STRING, "expected String " + Arrays.toString(ValueType.values()));
        }
    }
@Test
    public void deserialize() throws IOException {
        assertThat(objectMapper.readValue("\"boolean\"", ValueType.class)).isEqualTo(ValueType.BOOLEAN);
        assertThat(objectMapper.readValue("\"double\"", ValueType.class)).isEqualTo(ValueType.DOUBLE);
        assertThat(objectMapper.readValue("\"float\"", ValueType.class)).isEqualTo(ValueType.FLOAT);
        assertThat(objectMapper.readValue("\"integer\"", ValueType.class)).isEqualTo(ValueType.INTEGER);
        assertThat(objectMapper.readValue("\"long\"", ValueType.class)).isEqualTo(ValueType.LONG);
        assertThat(objectMapper.readValue("\"string\"", ValueType.class)).isEqualTo(ValueType.STRING);
        assertThat(objectMapper.readValue("\"parameter\"", ValueType.class)).isEqualTo(ValueType.PARAMETER);
        assertThatThrownBy(() -> objectMapper.readValue("\"\"", ValueType.class))
                .isInstanceOf(JsonMappingException.class)
                .hasMessageStartingWith("Cannot deserialize value of type `org.graylog2.contentpacks.model.entities.references.ValueType` from String \"\": No enum constant org.graylog2.contentpacks.model.entities.references.ValueType");
        assertThatThrownBy(() -> objectMapper.readValue("\"UNKNOWN\"", ValueType.class))
                .isInstanceOf(JsonMappingException.class)
                .hasMessageStartingWith("Cannot deserialize value of type `org.graylog2.contentpacks.model.entities.references.ValueType` from String \"UNKNOWN\": No enum constant org.graylog2.contentpacks.model.entities.references.ValueType");
        assertThatThrownBy(() -> objectMapper.readValue("0", ValueType.class))
                .isInstanceOf(JsonMappingException.class)
                .hasMessageStartingWith("Unexpected token (VALUE_NUMBER_INT), expected VALUE_STRING: expected String");
        assertThatThrownBy(() -> objectMapper.readValue("true", ValueType.class))
                .isInstanceOf(JsonMappingException.class)
                .hasMessageStartingWith("Unexpected token (VALUE_TRUE), expected VALUE_STRING: expected String");
        assertThatThrownBy(() -> objectMapper.readValue("{}", ValueType.class))
                .isInstanceOf(JsonMappingException.class)
                .hasMessageStartingWith("Unexpected token (START_OBJECT), expected VALUE_STRING: expected String");
        assertThatThrownBy(() -> objectMapper.readValue("[]", ValueType.class))
                .isInstanceOf(JsonMappingException.class)
                .hasMessageStartingWith("Unexpected token (START_ARRAY), expected VALUE_STRING: expected String");
    }