Added Abbreviate renderers

This commit is contained in:
Erik C. Thauvin 2023-03-19 15:11:07 -07:00
parent 4dd5df1d61
commit 1aa2bc2681
8 changed files with 139 additions and 87 deletions

View file

@ -23,6 +23,18 @@ import rife.template.TemplateFactory;
import static org.assertj.core.api.Assertions.assertThat;
class TestFormat {
@Test
void testAbbreviate() {
var t = TemplateFactory.HTML.get("abbreviate");
t.setAttribute(TestCase.FOO, TestCase.SAMPLE_TEXT);
System.out.println(t.getContent());
assertThat(t.getContent()).as("max=12").endsWith("").hasSize(12);
t = TemplateFactory.TXT.get("abbreviate");
t.setAttribute(TestCase.FOO, TestCase.SAMPLE_TEXT);
assertThat(t.getContent()).as("max=8").endsWith("...").hasSize(8);
}
@Test
void testFormatCreditCard() {
var t = TemplateFactory.TXT.get("formatCreditCard");