package org.ale.app;

import static org.junit.Assert.assertEquals;

import org.junit.Test;


public class TwitterLinkCreatorTest {

	@Test
	public void shouldProcessSingleTwitterName() {
		String result = TwitterLinkCreator.process("@foobar");
		assertEquals("<a href=\"http://twitter.com/foobar\">@foobar</a>", result);
	}
	
	@Test
	public void shouldProcessSeveralTwitterNames() {
		String result = TwitterLinkCreator.process("@foo, @bar");
		assertEquals("<a href=\"http://twitter.com/foo\">@foo</a>, <a href=\"http://twitter.com/bar\">@bar</a>", result);
	}
	
	@Test
	public void shouldProcessNameWithUnderscore() {
		String result = TwitterLinkCreator.process("@foo_bar");
		assertEquals("<a href=\"http://twitter.com/foo_bar\">@foo_bar</a>", result);
	}
}

@@ -61,16 +61,41 @@
 quals;%0A%0A
+import org.junit.Before;%0A
 import o
@@ -150,17 +150,158 @@
 Test %7B%0A%0A
-%09
+    private String twitterAddress;%0A%0A    @Before%0A    public void setup()%7B%0A        twitterAddress = %22%3Ca href=%5C%22http://twitter.com/%22;%0A    %7D%0A%0A    
 @Test%0A%09p
@@ -342,26 +342,32 @@
 terName() %7B%0A
-%09%09
+        
 String resul
@@ -405,26 +405,33 @@
 %22@foobar%22);%0A
-%09%09
+%0A        
 assertEquals
@@ -435,38 +435,25 @@
 als(
-%22%3Ca href=%5C%22http://twitter.com/
+twitterAddress +%22
 foob
@@ -598,26 +598,33 @@
 oo, @bar%22);%0A
-%09%09
+%0A        
 assertEquals
@@ -628,38 +628,25 @@
 als(
-%22%3Ca href=%5C%22http://twitter.com/
+twitterAddress +%22
 foo%5C
@@ -686,16 +686,19 @@
 ter.com/
+%22+%22
 bar%5C%22%3E@b
@@ -834,18 +834,25 @@
 _bar%22);%0A
-%09%09
+%0A        
 assertEq
@@ -860,38 +860,25 @@
 als(
-%22%3Ca href=%5C%22http://twitter.com/
+twitterAddress +%22
 foo_

Refactor tests: Extracted the twitter address to a field