Search in sources :

Example 1 with JavaTestDocsGenerator

use of org.neo4j.doc.tools.JavaTestDocsGenerator in project neo4j-documentation by neo4j.

the class TestJavaTestDocsGenerator method will_not_complain_about_missing_snippets.

@Documented(value = "@@snippet1\n")
@Test
@Graph("I know you")
public void will_not_complain_about_missing_snippets() throws Exception {
    data.get();
    JavaTestDocsGenerator doc = gen.get();
    doc.document(directory.getAbsolutePath(), sectionName);
}
Also used : JavaTestDocsGenerator(org.neo4j.doc.tools.JavaTestDocsGenerator) Graph(org.neo4j.test.GraphDescription.Graph) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test)

Example 2 with JavaTestDocsGenerator

use of org.neo4j.doc.tools.JavaTestDocsGenerator in project neo4j-documentation by neo4j.

the class TestJavaTestDocsGenerator method canCreateDocsFromSnippetsInAnnotations.

@Documented("Title2.\n" + "\n" + "@@snippet1\n" + "\n" + "           more stuff\n" + "\n" + "\n" + "@@snippet2")
@Test
@Graph("I know you")
public void canCreateDocsFromSnippetsInAnnotations() throws Exception {
    data.get();
    JavaTestDocsGenerator doc = gen.get();
    doc.setGraph(graphdb);
    assertNotNull(data.get().get("I"));
    String snippet1 = "snippet1-value";
    String snippet2 = "snippet2-value";
    doc.addSnippet("snippet1", snippet1);
    doc.addSnippet("snippet2", snippet2);
    doc.document(directory.getAbsolutePath(), sectionName);
    String result = readFileAsString(new File(sectionDirectory, "title2.asciidoc"));
    assertTrue(result.contains("include::includes/title2-snippet1.asciidoc[]"));
    assertTrue(result.contains("include::includes/title2-snippet2.asciidoc[]"));
    result = readFileAsString(new File(new File(sectionDirectory, "includes"), "title2-snippet1.asciidoc"));
    assertTrue(result.contains(snippet1));
    result = readFileAsString(new File(new File(sectionDirectory, "includes"), "title2-snippet2.asciidoc"));
    assertTrue(result.contains(snippet2));
}
Also used : JavaTestDocsGenerator(org.neo4j.doc.tools.JavaTestDocsGenerator) File(java.io.File) Graph(org.neo4j.test.GraphDescription.Graph) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test)

Example 3 with JavaTestDocsGenerator

use of org.neo4j.doc.tools.JavaTestDocsGenerator in project neo4j-documentation by neo4j.

the class TestJavaTestDocsGenerator method can_create_docs_from_method_name.

@Documented(value = "Title1.\n\nhej\n@@snippet1\n\nmore docs\n@@snippet_2-1\n@@snippet12\n.")
@Test
@Graph("I know you")
public void can_create_docs_from_method_name() throws Exception {
    data.get();
    JavaTestDocsGenerator doc = gen.get();
    doc.setGraph(graphdb);
    assertNotNull(data.get().get("I"));
    String snippet1 = "snippet1-value";
    String snippet12 = "snippet12-value";
    String snippet2 = "snippet2-value";
    doc.addSnippet("snippet1", snippet1);
    doc.addSnippet("snippet12", snippet12);
    doc.addSnippet("snippet_2-1", snippet2);
    doc.document(directory.getAbsolutePath(), sectionName);
    String result = readFileAsString(new File(sectionDirectory, "title1.asciidoc"));
    assertTrue(result.contains("include::includes/title1-snippet1.asciidoc[]"));
    assertTrue(result.contains("include::includes/title1-snippet_2-1.asciidoc[]"));
    assertTrue(result.contains("include::includes/title1-snippet12.asciidoc[]"));
    File includes = new File(sectionDirectory, "includes");
    result = readFileAsString(new File(includes, "title1-snippet1.asciidoc"));
    assertTrue(result.contains(snippet1));
    result = readFileAsString(new File(includes, "title1-snippet_2-1.asciidoc"));
    assertTrue(result.contains(snippet2));
    result = readFileAsString(new File(includes, "title1-snippet12.asciidoc"));
    assertTrue(result.contains(snippet12));
}
Also used : JavaTestDocsGenerator(org.neo4j.doc.tools.JavaTestDocsGenerator) File(java.io.File) Graph(org.neo4j.test.GraphDescription.Graph) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 JavaTestDocsGenerator (org.neo4j.doc.tools.JavaTestDocsGenerator)3 Documented (org.neo4j.kernel.impl.annotations.Documented)3 Graph (org.neo4j.test.GraphDescription.Graph)3 File (java.io.File)2