Package br.com.caelum.tubaina.builder

Examples of br.com.caelum.tubaina.builder.BookBuilder.addReaderFromString()


    @Test
    public void shouldNotCreateADirectoryChapterThatDoesntContainAnyImages() throws Exception {
        BookBuilder builder = builder("Com Imagens");
        builder.addReaderFromString("[chapter Um capítulo]\n"
                + "Uma introdução com imagem:\n");
        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);
View Full Code Here


    }

    @Test
    public void testGeneratorWithCorrectImages() throws IOException {
        BookBuilder builder = builder("Com imagens");
        builder.addReaderFromString("[chapter qualquer um]\n"
                + "[img baseJpgImage.jpg]");
        Book b = builder.build();
        new KindleModule().inject(b);

        generator.generate(b, tempDir);
View Full Code Here

    }

    @Test
    public void testGeneratorWithDoubledImage() throws TubainaException, IOException {
        BookBuilder builder = builder("Com imagens");
        builder.addReaderFromString("[chapter qualquer um]\n"
                + "[img baseJpgImage.jpg]\n[img baseJpgImage.jpg]");

        Book b = builder.build();
        new KindleModule().inject(b);
        try {
View Full Code Here

    }

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

        String content = "[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";
        BookBuilder builder = builder("livro");
        builder.addAllReadersOfNonNumberedFromStrings(Arrays.asList("[chapter introduction]\n" + "texto do prefácio\n"));
    builder.addReaderFromString(content);
        builder.addReaderFromString("[chapter Introdução]\n"
                + "Algum texto de introdução\n");
        book = builder.build();
        temp = new File("tmp");
        temp.mkdir();
View Full Code Here

                + "[section Primeira seção]\n" + "texto da prim seção\n"
                + "[section Segunda seção]\n" + "texto da segunda seção\n\n";
        BookBuilder builder = builder("livro");
        builder.addAllReadersOfNonNumberedFromStrings(Arrays.asList("[chapter introduction]\n" + "texto do prefácio\n"));
    builder.addReaderFromString(content);
        builder.addReaderFromString("[chapter Introdução]\n"
                + "Algum texto de introdução\n");
        book = builder.build();
        temp = new File("tmp");
        temp.mkdir();
View Full Code Here

    }

    @Test
    public void testGeneratorWithCorrectImages() throws IOException {
      BookBuilder builder = builder("com-imagens");
        builder.addReaderFromString("[chapter qualquer um]\n"
                + "[img baseJpgImage.jpg]");
        Book b = builder.build();
        new HtmlModule().inject(b);

        generator.generate(b, temp);
View Full Code Here

    @Test
    public void testGeneratorWithDoubledImage() throws TubainaException, IOException {
        String content = "[chapter qualquer um]\n"
                + "[img baseJpgImage.jpg]\n[img baseJpgImage.jpg]";
        BookBuilder builder = builder("com-erro");
        builder.addReaderFromString(content);

        Book b = builder.build();
        new HtmlModule().inject(b);
        try {
            generator.generate(b, temp);
View Full Code Here

    @Test
    public void testGeneratorWithUnexistantImage() throws TubainaException, IOException {
        String chapterContent = "[chapter qualquer um]\n"
                + "[img src/test/resources/someImage.gif]";
        BookBuilder builder = builder("com-erro");
        builder.addReaderFromString(chapterContent);
        try {
            Book b = builder.build();
            new HtmlModule().inject(b);
            generator.generate(b, temp);
            Assert.fail("Should raise an exception");
View Full Code Here

    @Test
    public void testGeneratorWithDuppedChapterName() throws TubainaException, IOException {
        String fileContent = "[chapter qualquer um]\n"
                + "alguma coisa\n[chapter qualquer um]outra coisa";
        BookBuilder builder = builder("com-erro");
        builder.addReaderFromString(fileContent);
        try {
            Book b = builder.build();
            new HtmlModule().inject(b);
            generator.generate(b, temp);
            Assert.fail("Should raise an exception");
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.