// Path: app/src/main/java/de/codecentric/util/TwitterLinkCreator.java
// public class TwitterLinkCreator {
// 
//     public static final Pattern TWITTER_NAME_PATTERN = Pattern.compile("@[a-zA-Z0-9_]+");
// 
//     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://twitter.com/" + name.substring(1) + "\">" + name + "</a>");
//         }
// 
//         return result;
//     }
// }


import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import de.codecentric.util.TwitterLinkCreator;
package de.codecentric.util;




public class TwitterLinkCreatorTest {

    String twitterLink;

    @Before
    public void setup() {

        twitterLink = "http://twitter.com/";
    }

    @Test
    public void shouldProcessSingleTwitterName() {
        String validTwitterName = "@foobar";
        String linkWithOneTwitterName = "<a href=\"" + twitterLink + "foobar\">@foobar</a>";

// Path: app/src/main/java/de/codecentric/util/TwitterLinkCreator.java
// public class TwitterLinkCreator {
// 
//     public static final Pattern TWITTER_NAME_PATTERN = Pattern.compile("@[a-zA-Z0-9_]+");
// 
//     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://twitter.com/" + name.substring(1) + "\">" + name + "</a>");
//         }
// 
//         return result;
//     }
// }


// Path: app/src/test/java/de/codecentric/util/TwitterLinkCreatorTest.java
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import de.codecentric.util.TwitterLinkCreator;

package de.codecentric.util;




public class TwitterLinkCreatorTest {

    String twitterLink;

    @Before
    public void setup() {

        twitterLink = "http://twitter.com/";
    }

    @Test
    public void shouldProcessSingleTwitterName() {
        String validTwitterName = "@foobar";
        String linkWithOneTwitterName = "<a href=\"" + twitterLink + "foobar\">@foobar</a>";

        String result = TwitterLinkCreator.process(validTwitterName);