@Override
    public Optional<String> getValue(Object arg, String type) {
        if (arg instanceof List) {
            List<?> list = (List<?>) arg;
            int index = Integer.parseInt(getKey(type));
            if (index < 0 || index >= list.size()) {
                return Optional.empty();
            }
            Object object = list.get(index);
            return object == null ? Optional.empty() : Optional.of(String.valueOf(object));
        }
        return Optional.empty();
    }
@Test
    public void testValue() {
        TypeStrategy strategy = new ListTypeStrategy();
        List<String> list = new ArrayList<>();
        list.add("foo");
        list.add(null);

        // normal
        Assert.assertEquals("foo", strategy.getValue(list, ".get(0)").orElse(null));

        // test null
        Assert.assertNotEquals("foo", strategy.getValue(list, ".get(1)").orElse(null));

        // test out of bounds
        Assert.assertNotEquals("foo", strategy.getValue(list, ".get(2)").orElse(null));

        // test non arrays
        Assert.assertNotEquals("foo", strategy.getValue("bar", ".get(0)").orElse(null));

        // the test is not equal
        Assert.assertNotEquals("bar", strategy.getValue(list, ".get(0)").orElse(null));
    }