Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Feb 27, 2019
1 parent b5963bd commit 35ea46c
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

import static org.junit.Assert.assertEquals;

@RunWith(RobolectricTestRunner.class)
public class TextUtilsTest {

Expand Down Expand Up @@ -47,7 +49,7 @@ public void markDownToHtmlEscapesBackslash() {
{"\\\\\\", "\\\\"}};

for (String[] testCase : tests) {
Assert.assertEquals(testCase[1], TextUtils.markdownToHtml(testCase[0]));
assertEquals(testCase[1], TextUtils.markdownToHtml(testCase[0]));
}
}

Expand All @@ -63,7 +65,7 @@ public void markDownToHtml_EscapesLessThan() {
{"test < 1/>", "test &lt; 1/>"}
};
for (String[] testCase: tests) {
Assert.assertEquals(testCase[1], TextUtils.markdownToHtml(testCase[0]));
assertEquals(testCase[1], TextUtils.markdownToHtml(testCase[0]));
}
}

Expand All @@ -77,7 +79,7 @@ public void markDownToHtml_SupportsHtml() {
"</closetag>"
};
for (String testCase: tests) {
Assert.assertEquals(testCase, TextUtils.markdownToHtml(testCase));
assertEquals(testCase, TextUtils.markdownToHtml(testCase));
}
}

Expand All @@ -88,8 +90,17 @@ public void textToHtml_SupportsEscapedLt() {
};

for (String testCase: tests) {
Assert.assertEquals(testCase, TextUtils.textToHtml(testCase).toString());
assertEquals(testCase, TextUtils.textToHtml(testCase).toString());
}
}

@Test
public void ellipsizeBeginningTest() {
assertEquals("SampleText",
TextUtils.ellipsizeBeginning("SampleText"));
assertEquals("100CharsTextwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww",
TextUtils.ellipsizeBeginning("100CharsTextwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"));
assertEquals("...harsTextwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww",
TextUtils.ellipsizeBeginning("101CharsTextwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"));
}
}

0 comments on commit 35ea46c

Please sign in to comment.