21
21
@ RunWith (value =Parameterized .class )
22
22
@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
23
23
public class TestURL {
24
- @ Rule
24
+ @ Rule
25
25
public TestRule watcher = new TestWatcher () {
26
26
protected void starting (Description description ) {
27
- System .out .println ("Starting test: " + description .getMethodName ());
27
+ System .out .println ("Starting test: " + description .getMethodName ());
28
28
}
29
29
@ Override
30
30
protected void failed (Throwable e , Description description ) {
31
- System .out .println ("Test fail: " + mod +"\t " + description .getMethodName () + "\n " );
31
+ System .out .println ("Test fail: " + mod +"\t " + description .getMethodName () + "\n " );
32
32
}
33
33
34
34
@ Override
35
35
protected void succeeded (Description description ) {
36
36
System .out .println ("Test success: " + mod +"\t " + description .getMethodName () + "\n " );
37
- }
38
- };
39
-
37
+ }
38
+ };
39
+
40
40
@ Parameterized .Parameters
41
41
public static Collection <Object []> getParameters () {
42
42
return Arrays .asList (
43
- new Object [][] {
44
- {0 ,"http://www.comicvip.com/html/9718.html" ,"jcomicdownloader.module.ParseEC" }
45
- ,{1 ,"http://manhua.dmzj.com/ganwumeixiaomai/" ,"jcomicdownloader.module.Parse178" }
46
- ,{2 ,"http://comic.sfacg.com/HTML/GWMXM/" ,"jcomicdownloader.module.ParseSF" }
47
- ,{3 ,"http://comic.kukudm.com/comiclist/1842/index.htm" ,"jcomicdownloader.module.ParseKUKU" }
48
- ,{4 ,"http://comic.ck101.com/comic/18181" ,"jcomicdownloader.module.ParseCK" }
49
- ,{5 ,"http://www.tuku.cc/comic/11977/" ,"jcomicdownloader.module.ParseTUKU" }
50
- ,
51
- {6 ,"http://www.dm5.com/manhua-kissxdeath/" ,"jcomicdownloader.module.ParseDM5" }
52
- }
43
+ new Object [][] { //uncomment which site for test
44
+ // {0,"http://www.comicvip.com/html/9718.html","jcomicdownloader.module.ParseEC"}
45
+ // ,
46
+ // {1,"http://manhua.dmzj.com/ganwumeixiaomai/","jcomicdownloader.module.Parse178"}
47
+ // ,
48
+ // {2,"http://comic.sfacg.com/HTML/GWMXM/","jcomicdownloader.module.ParseSF"}
49
+ // ,
50
+ // {3,"http://comic.kukudm.com/comiclist/1842/index.htm","jcomicdownloader.module.ParseKUKU"}
51
+ // ,
52
+ // {4,"http://comic.ck101.com/comic/18181","jcomicdownloader.module.ParseCK"}
53
+ // ,
54
+ // {5,"http://www.tuku.cc/comic/11977/","jcomicdownloader.module.ParseTUKU"}
55
+ // ,
56
+ // {6,"http://www.dm5.com/manhua-kissxdeath/","jcomicdownloader.module.ParseDM5"}
57
+ // ,
58
+ // {7,"https://tieba.baidu.com/p/4941848745","jcomicdownloader.module.ParseBAIDU"}
59
+ ,
60
+ {8 ,"https://tieba.baidu.com/p/4978124556" ,"jcomicdownloader.module.ParseBAIDU" }
61
+
62
+ }
53
63
);
54
64
}
55
-
65
+
56
66
private final String url ,mod ;
57
67
private ParseOnlineComicSite s ;
58
68
59
69
public TestURL (Integer i ,String url , String mod ) {
60
70
this .url = url ;
61
- this .mod = mod ;;
62
-
71
+ this .mod = mod ;;
72
+
63
73
noGuiTweak :{ //just a label
64
74
Run .isAlive =true ;// tweak for no download
65
- Common .consoleThreadName = Thread .currentThread ().getName ();
75
+ Common .consoleThreadName = Thread .currentThread ().getName ();
66
76
}
67
-
77
+
68
78
Common .debugPrintln ("-----------------" +i +"--------------------" );
69
79
try {
70
- this .s =(ParseOnlineComicSite )Class .forName (mod ).newInstance ();
71
- ignoreBug_001 :{// will fail if not set in some case
72
- this .s .setURL (url );
80
+ this .s =(ParseOnlineComicSite )Class .forName (mod ).newInstance ();
81
+ ignoreBug_001 :{// will fail if not set in some case
82
+ this .s .setURL (url );
73
83
}
74
84
}catch (Exception x ){
75
85
s =null ;
76
- fail ("Module " +mod +" has exception : " +x .getMessage ());
86
+ fail ("Module " +mod +" has exception : " +x .getMessage ());
77
87
}
78
88
}
79
-
80
- @ org .junit .Ignore
81
- @ org .junit .Test
89
+
90
+ // @org.junit.Ignore
91
+ @ org .junit .Test
82
92
public void test000Run () {
83
93
RunModule r =new RunModule ();
84
- // try{
85
- r .runMainProcess (s , url );
94
+ // try{
95
+ r .runMainProcess (s , url );
86
96
// }catch(Exception e){
87
97
// fail(e.toString());
88
- // }
98
+ // }
89
99
}
90
-
91
- @ org .junit .Ignore
92
- @ org .junit .Test
100
+
101
+ // @org.junit.Ignore
102
+ @ org .junit .Test
93
103
public void test001Url () {
94
104
assertTrue (mod ,s .canParserHandle (url ));
95
105
}
96
-
97
- @ org .junit .Ignore
106
+
107
+ // @org.junit.Ignore
98
108
@ org .junit .Test
99
109
public void test002setParameters () {
100
110
try {
@@ -104,18 +114,18 @@ public void test002setParameters() {
104
114
fail (e .toString ()+ " : " +e .getMessage ());
105
115
}
106
116
}
107
-
108
- @ org .junit .Ignore
117
+
118
+ // @org.junit.Ignore
109
119
@ org .junit .Test
110
- public void test003getAllPageString () {
120
+ public void test003getAllPageString () {
111
121
String allPageString = s .getAllPageString (url );
112
122
assertNotNull (allPageString );
113
123
}
114
-
115
- @ org .junit .Ignore
124
+
125
+ // @org.junit.Ignore
116
126
@ org .junit .Test
117
127
public void test004getTitleOnMainPage () {
118
- String allPageString = s .getAllPageString (url );
128
+ String allPageString = s .getAllPageString (url );
119
129
String title =s .getTitleOnMainPage (url , allPageString );
120
130
System .out .println ("test004getTitleOnMainPage : " +title );
121
131
assertNotNull (title );
0 commit comments