admin
2021-08-27 8fee151ffae0c3818694b7318583814bf92663e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.hxh.spring.test.video;
 
import com.google.gson.Gson;
import com.yeshi.buwan.job.RankJob;
import com.yeshi.buwan.util.rank.IqiyiRankUtil;
import com.yeshi.buwan.util.rank.MaoYanUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.yeshi.utils.StringUtil;
 
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Map;
 
@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试
@ContextConfiguration(locations = {"classpath:spring.xml"})
@WebAppConfiguration
public class RankTest {
 
    @Resource
    private RankJob rankJob;
 
    @Test
    public void getMaoYanRank() {
        try {
            List<String> list = MaoYanUtil.getTVRank(30);
            System.out.println(StringUtil.concat(list, ","));
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        try {
            List<String> list = MaoYanUtil.getShowRank(30);
            System.out.println(StringUtil.concat(list, ","));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
 
    @Test
    public void getIqiyiRank() {
        try {
            Map<String, List<String>> map = IqiyiRankUtil.getRank(10);
            String json = new Gson().toJson(map);
            System.out.println(json);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
 
    @Test
    public void updateRank() throws Exception {
        rankJob.updateIqiyiRank("");
    }
 
}