### Question:
TwitterLinkCreator { public static String process(String result) { Matcher m = TWITTER_NAME_PATTERN.matcher(result); while (m.find()) { final String name = m.group(); result = result.replaceFirst(name, "<a href=\"http: } return result; }  static String process(String result); static final Pattern TWITTER_NAME_PATTERN; }### Answer:
@Test public void shouldProcessSingleTwitterName() { String validTwitterName = "@foobar"; String linkWithOneTwitterName = "<a href=\"" + twitterLink + "foobar\">@foobar</a>"; String result = TwitterLinkCreator.process(validTwitterName); assertEquals(linkWithOneTwitterName, result); }
@Test public void shouldProcessSeveralTwitterNames() { String twoValidTwitterNames = "@foo, @bar"; String linkWithTwoTwitterNames = "<a href=\"" + twitterLink + "foo\">@foo</a>, " + "<a href=\"" + twitterLink + "bar\">@bar</a>"; String result = TwitterLinkCreator.process(twoValidTwitterNames); assertEquals(linkWithTwoTwitterNames, result); }
@Test public void shouldProcessNameWithUnderscore() { String validTwitterNameWithUnderscore = "@foo_bar"; String linkWithOneTwitterName = "<a href=\"" + twitterLink + "foo_bar\">@foo_bar</a>"; String result = TwitterLinkCreator.process(validTwitterNameWithUnderscore); assertEquals(linkWithOneTwitterName, result); }