Skip to content

Commit

Permalink
fixing failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
csokol committed May 23, 2013
1 parent 1a46905 commit 63d693b
Showing 1 changed file with 11 additions and 3 deletions.
Expand Up @@ -33,7 +33,6 @@ public class FlatHtmlGeneratorTest {
private File temp;

private TubainaBuilderData data;
private BookBuilder builder;

@Before
public void setUp() throws IOException {
Expand All @@ -46,13 +45,13 @@ public void setUp() throws IOException {
data = new TubainaBuilderData(false, TubainaBuilder.DEFAULT_TEMPLATE_DIR, false, false,
"teste.tex");

builder = new BookBuilder("livro", new SectionsManager());
generator = new FlatHtmlGenerator(parser, data);

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";
builder.addReaderFromString(content);
BookBuilder builder = builder("livro");
builder.addReaderFromString(content);
builder.addReaderFromString("[chapter Introdução]\n"
+ "Algum texto de introdução\n");
book = builder.build();
Expand Down Expand Up @@ -125,6 +124,7 @@ public void shouldNotCreateDirectoriesForSections() throws IOException {

@Test
public void testGeneratorWithCorrectImages() throws IOException {
BookBuilder builder = builder("com-imagens");
builder.addReaderFromString("[chapter qualquer um]\n"
+ "[img baseJpgImage.jpg]");
Book b = builder.build();
Expand All @@ -143,6 +143,7 @@ public void testGeneratorWithCorrectImages() throws IOException {
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();
Expand All @@ -159,6 +160,7 @@ public void testGeneratorWithDoubledImage() throws TubainaException, IOException
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();
Expand All @@ -174,6 +176,7 @@ public void testGeneratorWithUnexistantImage() throws TubainaException, IOExcept
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();
Expand All @@ -185,4 +188,9 @@ public void testGeneratorWithDuppedChapterName() throws TubainaException, IOExce
// OK
}
}


public BookBuilder builder(String title) {
return new BookBuilder(title, new SectionsManager());
}
}

0 comments on commit 63d693b

Please sign in to comment.