blob: e75c2e6a9800a0571cff2d4bc20648d1889e08da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package cgeo.geocaching.utils;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.commons.lang3.StringUtils;
import junit.framework.TestCase;
public class HtmlUtilsTest extends TestCase {
public static void testExtractText() {
assertThat(HtmlUtils.extractText(null)).isEqualTo(StringUtils.EMPTY);
assertThat(HtmlUtils.extractText(StringUtils.EMPTY)).isEqualTo(StringUtils.EMPTY);
assertThat(HtmlUtils.extractText(" ")).isEqualTo(StringUtils.EMPTY);
assertThat(HtmlUtils.extractText("<b>bold</b>")).isEqualTo("bold");
}
public static void testRemoveExtraParagraph() {
assertThat(HtmlUtils.removeExtraParagraph("<p></p>")).isEqualTo("");
assertThat(HtmlUtils.removeExtraParagraph("<p>Test</p>")).isEqualTo("Test");
assertThat(HtmlUtils.removeExtraParagraph("<p>1</p><p>2</p>")).isEqualTo("<p>1</p><p>2</p>");
}
}
|