public Integer asInteger(Map<String, ValueReference> parameters) {
        switch (valueType()) {
            case INTEGER:
                return Integer.class.cast(value());
            case PARAMETER:
                return asType(parameters, Integer.class);
            default:
                throw new IllegalStateException("Expected value reference of type INTEGER but got " + valueType());
        }
    }
@Test
    public void asInteger() {
        assertThat(ValueReference.of(42).asInteger(Collections.emptyMap())).isEqualTo(42);
        assertThatThrownBy(() -> ValueReference.of("Test").asInteger(Collections.emptyMap()))
                .isInstanceOf(IllegalStateException.class)
                .hasMessage("Expected value reference of type INTEGER but got STRING");
    }