public String toRst() {
        StringBuilder b = new StringBuilder();
        for (ConfigKey key : sortedConfigs()) {
            if (key.internalConfig) {
                continue;
            }
            getConfigKeyRst(key, b);
            b.append("\n");
        }
        return b.toString();
    }
@Test
    public void toRst() {
        final ConfigDef def = new ConfigDef()
                .define("opt1", Type.STRING, "a", ValidString.in("a", "b", "c"), Importance.HIGH, "docs1")
                .define("opt2", Type.INT, Importance.MEDIUM, "docs2")
                .define("opt3", Type.LIST, Arrays.asList("a", "b"), Importance.LOW, "docs3")
                .define("opt4", Type.BOOLEAN, false, Importance.LOW, null);

        final String expectedRst =
                "``opt2``\n" +
                "  docs2\n" +
                "\n" +
                "  * Type: int\n" +
                "  * Importance: medium\n" +
                "\n" +
                "``opt1``\n" +
                "  docs1\n" +
                "\n" +
                "  * Type: string\n" +
                "  * Default: a\n" +
                "  * Valid Values: [a, b, c]\n" +
                "  * Importance: high\n" +
                "\n" +
                "``opt3``\n" +
                "  docs3\n" +
                "\n" +
                "  * Type: list\n" +
                "  * Default: a,b\n" +
                "  * Importance: low\n" +
                "\n" +
                "``opt4``\n" +
                "\n" +
                "  * Type: boolean\n" +
                "  * Default: false\n" +
                "  * Importance: low\n" +
                "\n";

        assertEquals(expectedRst, def.toRst());
    }