Search in sources :

Example 6 with MindMap

use of com.igormaznitsa.mindmap.model.MindMap in project netbeans-mmd-plugin by raydac.

the class Text2MindMapImporterTest method testDoImport_Multilevel.

@Test
public void testDoImport_Multilevel() throws Exception {
    final MindMap result = INSTANCE.makeFromLines(asList("Solar system", "\tMercury", "\tVenus", "\tEarth", "\t\tMoon", "\tMars", "\t\tFobos", "\t\tDemos", "Jupiter"), null);
    assertEquals("Solar system", result.getRoot().getText());
    assertEquals(5, result.getRoot().getChildren().size());
    final Topic mars = result.getRoot().getChildren().get(3);
    final Topic jupiter = result.getRoot().getChildren().get(4);
    assertEquals("Mars", mars.getText());
    assertEquals(2, mars.getChildren().size());
    assertEquals("Jupiter", jupiter.getText());
}
Also used : MindMap(com.igormaznitsa.mindmap.model.MindMap) Topic(com.igormaznitsa.mindmap.model.Topic) Test(org.junit.Test)

Example 7 with MindMap

use of com.igormaznitsa.mindmap.model.MindMap in project netbeans-mmd-plugin by raydac.

the class Text2MindMapImporterTest method testDoImport_OnlyRoot.

@Test
public void testDoImport_OnlyRoot() throws Exception {
    final MindMap result = INSTANCE.makeFromLines(asList("\tSolar system   "), null);
    assertEquals("Solar system", result.getRoot().getText());
}
Also used : MindMap(com.igormaznitsa.mindmap.model.MindMap) Test(org.junit.Test)

Example 8 with MindMap

use of com.igormaznitsa.mindmap.model.MindMap in project netbeans-mmd-plugin by raydac.

the class Text2MindMapImporterTest method testDoImport_Multilevel2.

@Test
public void testDoImport_Multilevel2() throws Exception {
    final MindMap result = INSTANCE.makeFromLines(asList("solar system", "\tjupiter", "\tmars", " \t\tfobos", "\t\tdeimos", "\tpluto", "\tsaturn"), null);
    assertEquals("solar system", result.getRoot().getText());
    assertEquals(4, result.getRoot().getChildren().size());
    final Topic root = result.getRoot();
    assertEquals("jupiter", root.getChildren().get(0).getText());
    assertEquals("mars", root.getChildren().get(1).getText());
    assertEquals("pluto", root.getChildren().get(2).getText());
    assertEquals("saturn", root.getChildren().get(3).getText());
    final Topic mars = result.getRoot().getChildren().get(1);
    assertEquals(2, mars.getChildren().size());
    assertEquals("fobos", mars.getChildren().get(0).getText());
    assertEquals("deimos", mars.getChildren().get(1).getText());
}
Also used : MindMap(com.igormaznitsa.mindmap.model.MindMap) Topic(com.igormaznitsa.mindmap.model.Topic) Test(org.junit.Test)

Example 9 with MindMap

use of com.igormaznitsa.mindmap.model.MindMap in project netbeans-mmd-plugin by raydac.

the class Text2MindMapImporterTest method testImportFromFile.

@Test
public void testImportFromFile() throws Exception {
    final File file = new File(Text2MindMapImporter.class.getResource("tabbedtext.txt").getFile());
    assertTrue(file.isFile());
    final List<String> lines = FileUtils.readLines(file, "UTF-8");
    final MindMap result = INSTANCE.makeFromLines(lines, null);
    assertEquals(5, result.getRoot().getChildren().size());
}
Also used : MindMap(com.igormaznitsa.mindmap.model.MindMap) File(java.io.File) Test(org.junit.Test)

Example 10 with MindMap

use of com.igormaznitsa.mindmap.model.MindMap in project netbeans-mmd-plugin by raydac.

the class Text2MindMapImporterTest method testDoImport_Empty.

@Test
public void testDoImport_Empty() throws Exception {
    final MindMap result = INSTANCE.makeFromLines(asList("          "), null);
    assertNull(result.getRoot());
}
Also used : MindMap(com.igormaznitsa.mindmap.model.MindMap) Test(org.junit.Test)

Aggregations

MindMap (com.igormaznitsa.mindmap.model.MindMap)23 File (java.io.File)13 Topic (com.igormaznitsa.mindmap.model.Topic)8 IOException (java.io.IOException)7 StringReader (java.io.StringReader)7 Nonnull (javax.annotation.Nonnull)7 Test (org.junit.Test)7 Nullable (javax.annotation.Nullable)6 ArrayList (java.util.ArrayList)5 MMapURI (com.igormaznitsa.mindmap.model.MMapURI)4 MustNotContainNull (com.igormaznitsa.meta.annotation.MustNotContainNull)3 StringWriter (java.io.StringWriter)3 ExtraFile (com.igormaznitsa.mindmap.model.ExtraFile)2 HasOptions (com.igormaznitsa.mindmap.plugins.api.HasOptions)2 MindMapPanel (com.igormaznitsa.mindmap.swing.panel.MindMapPanel)2 FileInputStream (java.io.FileInputStream)2 PsiExtraFile (com.igormaznitsa.ideamindmap.lang.psi.PsiExtraFile)1 ExtraTopic (com.igormaznitsa.mindmap.model.ExtraTopic)1 MindMapController (com.igormaznitsa.mindmap.model.MindMapController)1 DialogProvider (com.igormaznitsa.mindmap.swing.panel.DialogProvider)1