KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > BlacklistTest


1 /*
2  * Created on Nov 12, 2003
3  */

4 package org.roller;
5
6 import org.roller.business.FileManagerTest;
7 import org.roller.util.Blacklist;
8
9 import junit.framework.Test;
10 import junit.framework.TestCase;
11 import junit.framework.TestSuite;
12
13 /**
14  * @author lance
15  */

16 public class BlacklistTest extends TestCase
17 {
18     private Blacklist blacklist;
19
20     /**
21      *
22      */

23     public BlacklistTest()
24     {
25         super();
26     }
27
28     /**
29      * @param arg0
30      */

31     public BlacklistTest(String JavaDoc arg0)
32     {
33         super(arg0);
34     }
35     
36     /**
37      * @see TestCase#setUp()
38      */

39     protected void setUp() throws Exception JavaDoc
40     {
41         super.setUp();
42         blacklist = Blacklist.getBlacklist(null,null);
43     }
44
45     /**
46      * @see TestCase#tearDown()
47      */

48     protected void tearDown() throws Exception JavaDoc
49     {
50         super.tearDown();
51         //System.out.println(blacklist);
52
}
53     
54     public void testIsBlacklisted0()
55     {
56         assertFalse(blacklist.isBlacklisted("four score and seven years ago.com"));
57     }
58     
59     // test non-regex
60
public void testIsBlacklisted1()
61     {
62         assertTrue(blacklist.isBlacklisted("00000-online-casino.com"));
63     }
64     
65     // test the regex patterns
66
public void testIsBlacklisted2()
67     {
68         assertTrue(blacklist.isBlacklisted("www.lsotr.com"));
69     }
70     
71     // test the regex patterns
72
public void testIsBlacklisted3()
73     {
74         assertTrue(blacklist.isBlacklisted("www.lsotr.com"));
75     }
76     
77     // test the regex patterns
78
public void testIsBlacklisted4()
79     {
80         assertTrue(blacklist.isBlacklisted("blow-job.com"));
81     }
82     
83     // test the regex patterns
84
public void testIsBlacklisted5()
85     {
86         assertTrue(blacklist.isBlacklisted("buymoreonline.com"));
87     }
88     
89     // test the regex patterns
90
public void testIsBlacklisted6()
91     {
92         assertTrue(blacklist.isBlacklisted("diet-enlargement.com"));
93     }
94     
95     // test the regex patterns
96
public void testIsBlacklisted7()
97     {
98         assertTrue(blacklist.isBlacklisted("viagra.com"));
99     }
100     
101     // test the regex patterns
102
public void testIsBlacklisted8()
103     {
104         assertTrue(blacklist.isBlacklisted("ragazze-something.com"));
105     }
106
107     public static Test suite()
108     {
109         return new TestSuite(BlacklistTest.class);
110     }
111 }
112
Popular Tags