单元测试搭建

master
shijie 4 years ago
parent 9ae34709fc
commit cae1d1917b
  1. 29
      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<String, Object> map = cityService.addCity(city);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value));
}
}
Loading…
Cancel
Save