@Override
    public Comparable convert(Comparable value) {
        if (!(value instanceof CompositeValue)) {
            throw new IllegalArgumentException("Cannot convert [" + value + "] to composite");
        }
        CompositeValue compositeValue = (CompositeValue) value;

        Comparable[] components = compositeValue.getComponents();
        Comparable[] converted = new Comparable[components.length];
        for (int i = 0; i < components.length; ++i) {
            Comparable component = components[i];
            if (component == NULL || component == NEGATIVE_INFINITY || component == POSITIVE_INFINITY) {
                converted[i] = component;
            } else {
                converted[i] = converters[i].convert(component);
            }
        }

        return new CompositeValue(converted);
    }
@Test
    public void testConversion() {
        assertEquals(value(1), converter(INTEGER_CONVERTER).convert(value(1)));
        assertEquals(value(1), converter(INTEGER_CONVERTER).convert(value("1")));

        assertEquals(value(1, true), converter(INTEGER_CONVERTER, BOOLEAN_CONVERTER).convert(value(1, true)));
        assertEquals(value(1, false), converter(INTEGER_CONVERTER, BOOLEAN_CONVERTER).convert(value(1.0, "non-true")));

        assertEquals(value(1, true, "foo"),
                converter(INTEGER_CONVERTER, BOOLEAN_CONVERTER, STRING_CONVERTER).convert(value(1, true, "foo")));
        assertEquals(value(1, false, "1"),
                converter(INTEGER_CONVERTER, BOOLEAN_CONVERTER, STRING_CONVERTER).convert(value(1.0, "non-true", 1)));
    }