Package org.raml.parser.visitor

Examples of org.raml.parser.visitor.YamlDocumentSuggester.suggest()


    @Test
    public void emptyRaml()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest("", "");
        assertThat(suggest.size(), is(1));
        assertThat(suggest.contains(new DefaultSuggestion(VERSION)), is(true));
        assertThat(suggest.get(0).getIndentation(), is(0));
    }
View Full Code Here


    @Test
    public void versionHeaderOnly()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(VERSION, "");
        assertThat(suggest.size(), is(ROOT_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("title")), is(true));
        assertThat(suggest.contains(new KeySuggestion("version")), is(true));
        assertThat(suggest.contains(new KeySuggestion("get")), is(false));
        assertThat(suggest.get(0).getIndentation(), is(-1));
View Full Code Here

    @Test
    public void versionHeaderAndSeparator()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(VERSION + "\n---\n", "");
        assertThat(suggest.size(), is(ROOT_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("title")), is(true));
        assertThat(suggest.contains(new KeySuggestion("version")), is(true));
        assertThat(suggest.contains(new KeySuggestion("get")), is(false));
        assertThat(suggest.get(0).getIndentation(), is(-1));
View Full Code Here

        String topSection = "#%RAML 0.8\n" +
                            "title: hola\n" +
                            "documentation:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "");
        assertThat(suggest.size(), is(ROOT_SUGGEST_COUNT - 2));
        assertThat(suggest.contains(new KeySuggestion("version")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(0));
    }
View Full Code Here

        String topSection = "#%RAML 0.8\n" +
                            "title: one\n" +
                            "/ResourceName:\n";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, " ", "");
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.size(), is(RESOURCE_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("is")), is(true));
        assertThat(suggest.contains(new KeySuggestion("get")), is(true));
        assertThat(suggest.contains(new KeySuggestion("delete")), is(true));
View Full Code Here

        String topSection = "#%RAML 0.8\n" +
                            "title: one\n" +
                            "/ResourceName: ";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, " ");
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.size(), is(RESOURCE_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("is")), is(true));
        assertThat(suggest.contains(new KeySuggestion("get")), is(true));
        assertThat(suggest.contains(new KeySuggestion("delete")), is(true));
View Full Code Here

    @Test
    public void topLevel()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(HEADER, "");
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.contains(new KeySuggestion("schemas")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(0));
    }
View Full Code Here

    @Test
    public void noDuplicates()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(HEADER, "");
        assertThat(suggest, notNullValue());
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.contains(new KeySuggestion("schemas")), is(true));
        assertThat(suggest.contains(new KeySuggestion("title")), is(false));
        assertThat(suggest.get(0).getIndentation(), is(0));
View Full Code Here

                            " - user: one\n" +
                            "traits:\n" +
                            "baseUri: http://localhost/api";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "", bottomSection);

        assertThat(suggest.size(), is(ROOT_SUGGEST_COUNT - 4));
        assertThat(suggest.contains(new KeySuggestion("title")), is(false));
        assertThat(suggest.contains(new KeySuggestion("schemas")), is(false));
        assertThat(suggest.contains(new KeySuggestion("traits")), is(false));
View Full Code Here

                               "  delete:\n" +
                               "/another:\n" +
                               "  patch:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, context, bottomSection);
        assertThat(suggest.get(0).getIndentation(), is(2));
        return suggest;
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.