From cae1d1917bb1462e197a2ea5ee2626d0fe93b60c Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Wed, 5 Aug 2020 14:32:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E6=90=AD?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yipin/liuwanr/Test.java | 2 +- .../com/yipin/liuwanr/CityServiceTest.java | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/test/java/com/yipin/liuwanr/CityServiceTest.java 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)); + } +}