Added Mask renderer

This commit is contained in:
Erik C. Thauvin 2023-03-19 12:04:47 -07:00
parent b34363fccf
commit 4dd5df1d61
7 changed files with 116 additions and 3 deletions

View file

@ -36,6 +36,24 @@ class TestFormat {
assertThat(t.getContent()).isEmpty();
}
@Test
void testMask() {
var t = TemplateFactory.HTML.get("mask");
var foo = "374380141731053";
t.setAttribute(TestCase.FOO, foo);
assertThat(t.getContent()).as("mask.html").isEqualTo("3743•••••••••••");
t = TemplateFactory.TXT.get("mask");
t.setAttribute(TestCase.FOO, foo);
assertThat(t.getContent()).as("mask.txt").isEqualTo("***************");
assertThat(RenderUtils.mask(foo, "?", 4, false)).as("mask=?")
.isEqualTo("???????????1053");
assertThat(RenderUtils.mask(foo, "-", 22, false)).as("unmasked=22")
.isEqualTo("---------------");
}
@Test
void testNormalize() {
var t = TemplateFactory.HTML.get("normalize");