
package com.twitter;

import java.util.regex.*;
import junit.framework.TestCase;
import com.twitter.*;

public class AutolinkTest extends TestCase {
  private Autolink linker;

  public void setUp() {
    linker = new Autolink();
  }

  public void testNoFollowByDefault() {
    String tweet = "This has a #hashtag";
    String expected = "This has a <a href=\"http://twitter.com/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\" rel=\"nofollow\">#hashtag</a>";
    assertAutolink(expected, linker.autoLinkHashtags(tweet));
  }

  public void testNoFollowDisabled() {
    linker.setNoFollow(false);
    String tweet = "This has a #hashtag";
    String expected = "This has a <a href=\"http://twitter.com/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>";
    assertAutolink(expected, linker.autoLinkHashtags(tweet));
  }

  protected void assertAutolink(String expected, String linked) {
    assertEquals("Autolinked text should not equal the input", expected, linked);
  }
}

@@ -868,16 +868,543 @@
 );%0A  %7D%0A%0A
+  /** See Also: http://github.com/mzsanford/twitter-text-rb/issues#issue/5 */%0A  public void testBlogspotWithDash() %7B%0A    linker.setNoFollow(false);%0A    String tweet = %22Url: http://samsoum-us.blogspot.com/2010/05/la-censure-nuit-limage-de-notre-pays.html%22;%0A    String expected = %22Url: %3Ca href=%5C%22http://samsoum-us.blogspot.com/2010/05/la-censure-nuit-limage-de-notre-pays.html%5C%22%3Ehttp://samsoum-us.blogspot.com/2010/05/la-censure-nuit-limage-de-notre-pays.html%3C/a%3E%22;%0A    assertAutolink(expected, linker.autoLinkURLs(tweet));%0A  %7D%0A%0A
   protec

Add a test for github issue #5