blob: f8ef8a4199de511f8ddfb92715f4f884632c5343 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package utils
import junit.framework.Assert.assertEquals
import org.jsoup.Jsoup
/**
* Parses it using JSOUP, trims whitespace at the end of the line and asserts if they are equal
* parsing is required to unify the formatting
*/
fun assertHtmlEqualsIgnoringWhitespace(expected: String, actual: String) {
assertEquals(
Jsoup.parse(expected).outerHtml().trimSpacesAtTheEndOfLine(),
Jsoup.parse(actual).outerHtml().trimSpacesAtTheEndOfLine()
)
}
private fun String.trimSpacesAtTheEndOfLine(): String =
replace(" \n", "\n")
|