diff --git a/tests/com/twitter/ExtractorTest.java b/tests/com/twitter/ExtractorTest.java index dce5b8e..af0b84a 100644 --- a/tests/com/twitter/ExtractorTest.java +++ b/tests/com/twitter/ExtractorTest.java @@ -5,6 +5,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.junit.BeforeClass; + import com.twitter.Extractor.Entity.Type; import junit.framework.TestCase; @@ -23,6 +25,11 @@ public static Test suite() { public void setUp() throws Exception { extractor = new Extractor(); } + + @BeforeClass + public void extractURLWithoutProtocol() { + extractor.setExtractURLWithoutProtocol(true); + } public static class OffsetConversionTest extends ExtractorTest { @@ -83,6 +90,12 @@ public void testConvertIndices() { assertOffsetConversionOk("\ud83d\ude02a\ud83d\ude02a\ud83d\ude02", "a"); } + + public void testExtractURLWithoutProtocol() { + + assertEquals(true, extractor.isExtractURLWithoutProtocol()); + + } private void assertOffsetConversionOk(String testData, String patStr) { // Build an entity at the location of patStr diff --git a/tests/com/twitter/RegexTest.java b/tests/com/twitter/RegexTest.java index f055c6f..0a9d43b 100644 --- a/tests/com/twitter/RegexTest.java +++ b/tests/com/twitter/RegexTest.java @@ -28,6 +28,9 @@ public void testAutoLinkHashtags() { assertCaptureCount(3, Regex.VALID_HASHTAG, "#日本語ハッシュタグ"); assertCaptureCount(3, Regex.VALID_HASHTAG, "#日本語ハッシュタグ"); + assertCaptureCount(3, Regex.VALID_HASHTAG, "#مرحبا شباب");//Arabic + + assertTrue(Regex.VALID_HASHTAG.matcher("これはOK #ハッシュタグ").find()); assertTrue(Regex.VALID_HASHTAG.matcher("これもOK。#ハッシュタグ").find()); assertFalse(Regex.VALID_HASHTAG.matcher("これはダメ#ハッシュタグ").find());