diff --git a/src/main/java/com/yipin/liuwanr/Test.java b/src/main/java/com/yipin/liuwanr/Test.java index c9d8102..6f952b4 100644 --- a/src/main/java/com/yipin/liuwanr/Test.java +++ b/src/main/java/com/yipin/liuwanr/Test.java @@ -20,7 +20,7 @@ public class Test { // System.out.println((new Test()).getURLContent(urlStr)); } - + public static String getURLContent() throws Exception { String strURL = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=40&sort=symbol&asc=1&node=hs_a&symbol=&_s_r_a=init"; URL url = new URL(strURL); diff --git a/src/test/java/com/yipin/liuwanr/CityServiceTest.java b/src/test/java/com/yipin/liuwanr/CityServiceTest.java new file mode 100644 index 0000000..5a4b911 --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/CityServiceTest.java @@ -0,0 +1,29 @@ +package com.yipin.liuwanr; + +import com.yipin.liuwanr.entity.City; +import com.yipin.liuwanr.service.CityService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.HashMap; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CityServiceTest { + + @Autowired + private CityService cityService; + + /** + * 新增城市信息方法测试 + */ + @Test + public void testAddCity() { + City city = new City(); + HashMap map = cityService.addCity(city); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } +}