@Test public void testTranslate() { assertEquals("", target.translate("")); assertEquals("", target.translate(null)); assertEquals("hello", target.translate("hello")); assertEquals("<a href=\"\">click</a>", target.translate("<a href=''>click</a>")); assertEquals("<a href=\"yahoo\">click</a>", target.translate("<a href='yahoo'>click</a>")); assertEquals("<a href=\"/rp/maps/abc\">click</a>", target.translate("<a href='/abc'>click</a>")); assertEquals("<a at= 'ab' href=\"/rp/maps/abc\">click</a>", target.translate("<a at= 'ab' href='/abc'>click</a>")); assertEquals("<a href=\"/rp/maps/abc\" >click</a>", target.translate("<a href='/abc' >click</a>")); assertEquals("hello<a href=\"/rp/maps/abc\">click</a>", target.translate("hello<a href='/abc'>click</a>")); assertEquals("hello<a href=\"/rp/maps/abc\">click</a>", target.translate("hello<a href=\"/abc\">click</a>")); assertEquals("hello<a href=\"/rp/maps/abc\">click</a>", target.translate("hello<a href=/abc>click</a>")); }
public String translate(String text) { for (TagTranslator translator : tagTranslators) { text= translator.translate(text); } return text; }
TextTranslator { public String translate(String text) { for (TagTranslator translator : tagTranslators) { text= translator.translate(text); } return text; } }
TextTranslator { public String translate(String text) { for (TagTranslator translator : tagTranslators) { text= translator.translate(text); } return text; } TextTranslator(Mapping mapping); }
TextTranslator { public String translate(String text) { for (TagTranslator translator : tagTranslators) { text= translator.translate(text); } return text; } TextTranslator(Mapping mapping); String translate(String text); }
TextTranslator { public String translate(String text) { for (TagTranslator translator : tagTranslators) { text= translator.translate(text); } return text; } TextTranslator(Mapping mapping); String translate(String text);  }