All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.commonmark.testutil.RenderingTestCase Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
package org.commonmark.testutil;

import static org.junit.Assert.assertEquals;

public abstract class RenderingTestCase {

    protected abstract String render(String source);

    protected void assertRendering(String source, String expectedResult) {
        String renderedContent = render(source);

        // include source for better assertion errors
        String expected = showTabs(expectedResult + "\n\n" + source);
        String actual = showTabs(renderedContent + "\n\n" + source);
        assertEquals(expected, actual);
    }

    private static String showTabs(String s) {
        // Tabs are shown as "rightwards arrow" for easier comparison
        return s.replace("\t", "\u2192");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy