Update: 定位到持仓与净值表格
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package cn.hezhaohui.fund.util;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
|
||||
@SpringBootTest
|
||||
class SoupUtilTest {
|
||||
@Resource
|
||||
private SoupUtil soupUtil;
|
||||
|
||||
@Test
|
||||
void parseContent() {
|
||||
Elements elements = soupUtil.parseContent(WebUtil.getContentByUrl(FundUtil.getUrlByFundId("001068")));
|
||||
System.out.println(elements);
|
||||
Assert.notNull(elements);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getHoldings() {
|
||||
Elements elements = soupUtil.parseContent(WebUtil.getContentByUrl(FundUtil.getUrlByFundId("001068")));
|
||||
Assert.notNull(elements);
|
||||
|
||||
Element holdings = soupUtil.getHoldings(elements);
|
||||
System.out.println(holdings);
|
||||
Assert.notNull(holdings);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getWorth() {
|
||||
Elements elements = soupUtil.parseContent(WebUtil.getContentByUrl(FundUtil.getUrlByFundId("001068")));
|
||||
Assert.notNull(elements);
|
||||
|
||||
Element worth = soupUtil.getWorth(elements);
|
||||
System.out.println(worth);
|
||||
Assert.notNull(worth);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user