package org.zwobble.mammoth.tests;

import org.junit.Test;
import org.zwobble.mammoth.Mammoth;
import org.zwobble.mammoth.results.Result;

import java.io.File;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.zwobble.mammoth.results.Result.success;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;

public class MammothTests {
    @Test
    public void emptyParagraphsAreIgnoredByDefault() {
        assertThat(
            convertToHtml("empty.docx").getValue(),
            is(""));
    }
    
    @Test
    public void docxContainingOneParagraphIsConvertedToSingleParagraphElement() {
        assertThat(
            convertToHtml("single-paragraph.docx"),
            deepEquals(success("<p>Walking on imported air</p>")));
    }

    private Result<String> convertToHtml(String name) {
        File file = TestData.file(name);
        return Mammoth.convertToHtml(file);
    }
}

@@ -806,16 +806,217 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void canReadFilesWithUtf8Bom() %7B%0A        assertThat(%0A            convertToHtml(%22utf8-bom.docx%22),%0A            deepEquals(success(%22%3Cp%3EThis XML has a byte order mark.%3C/p%3E%22)));%0A    %7D%0A%0A
     priv

Add test for reading XML with UTF8 BOM