Package br.com.caelum.tubaina

Examples of br.com.caelum.tubaina.Book


  @Test(expected = TubainaException.class)
  public void testGeneratorWithUnexistantImage() throws TubainaException, IOException {
    BookBuilder builder = builder("Com imagens");
    String fileContent = "[chapter qualquer um]\n" + "[img src/test/resources/someImage.gif]";
    builder.addReaderFromString(fileContent);
    Book b = builder.build();
    generator.generate(b, directory);
  }
View Full Code Here


    }

    @Test
    public void shouldCreateATOCFromBook() throws Exception {
        setUp();
        Book build = createBook();
       
        SingleHtmlTOCGenerator tocGenerator = new SingleHtmlTOCGenerator(build, cfg);
        String toc = tocGenerator.generateTOC().toString();
        assertTrue(toc.contains("O que é java"));
        assertTrue(toc.contains("Primeira seção"));
View Full Code Here

                "[chapter     O que é java?   ]\n" + "texto da seção\n"
                        + "[section Primeira seção]\n" + "texto da prim seção\n"
                        + "[section Segunda seção]\n" + "texto da segunda seção\n\n");
        builder.addReaderFromString("[chapter Introdução]\n"
                + "Algum texto de introdução\n");
        Book build = builder.build();
        return build;
    }
View Full Code Here

    }

    public Book build() {
        List<Chapter> introductionChapters = parseIntroductionChapters();
        parseBookChapters();
        return new Book(name, bookPartsBuilder.build(), introductionChapters);
    }
View Full Code Here

  }

  @Test
  public void testSection() {
    Section section = createSection("este é o texto da seção");
    Book book = new BookBuilder("livro", new SectionsManager()).build();
    new HtmlModule().inject(book);
    new HtmlModule().inject(section);
    String string = sectionToString.generateSection(book, "capitulo", 7, section, 4, 2).toString();
    Assert.assertEquals(1, countOccurrences(string, "class=\"sectionChapter\">(\\s)*capitulo(\\s)*<"));
    Assert.assertEquals(1, countOccurrences(string, "7.4 - Title"));
View Full Code Here

  }

  @Test
  public void testFlatSection() {
    Section section = createSection("este é o texto da seção");
    Book book = new BookBuilder("livro", new SectionsManager()).build();
    new HtmlModule().inject(book);
    new HtmlModule().inject(section);
   
    String string = sectionToString.generateSection(book, "capitulo", 7, section, 4, 2).toString();
    Assert.assertEquals(1, countOccurrences(string, "class=\"sectionChapter\">(\\s)*capitulo(\\s)*<"));
 
View Full Code Here

        FileUtils.deleteDirectory(tempDir);
    }

    @Test
    public void shouldCreateAppropriateDirectoryStructure() throws Exception {
        Book book = createsSimpleBookWithTitle("livro");
        new KindleModule().inject(book);

        generator.generate(book, tempDir);

        File includes = new File(tempDir, "includes/");
View Full Code Here

      return builder.build();
    }

    @Test
    public void shouldCreateTheBookFileWithEscapedSemicolon() throws Exception {
      Book book = createsSimpleEscapedColonBook("livro");
      new KindleModule().inject(book);
     
      generator.generate(book, tempDir);
     
      File theBookItself = new File(tempDir, "index.html");
View Full Code Here

      assertEquals(expectedContent, fileContent);
    }
   
    @Test
    public void shouldCreateTheBookFile() throws Exception {
        Book book = createsSimpleBookWithTitle("livro");
        new KindleModule().inject(book);

        generator.generate(book, tempDir);

        File theBookItself = new File(tempDir, "index.html");
View Full Code Here

        BookBuilder builder = builder("Com Imagens");
        builder.addReaderFromString("[chapter Um capítulo]\n"
                + "Uma introdução com imagem: \n\n" + "[img baseJpgImage.jpg]");
        builder.addReaderFromString("[chapter Outro capítulo]\n"
                + "Uma introdução com imagem: \n\n" + "[img basePngImage.png]");
        Book imageBook = builder.build();
        new KindleModule().inject(imageBook);

        generator.generate(imageBook, tempDir);

        File firstChapter = new File(tempDir, "um-capitulo/");
View Full Code Here

TOP

Related Classes of br.com.caelum.tubaina.Book

Copyright © 2018 www.massapicom. 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.