Update: 定位到持仓与净值表格

This commit is contained in:
2025-10-16 22:08:45 +08:00
parent 733ea32b5d
commit 731fdb4bde
3 changed files with 73 additions and 0 deletions
@@ -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);
}
}