空值报错!!!
@RunWith(SpringRunner.class)
@SpringBootTest
public class ShopCategoryServiceTest {
@Autowired
private ShopCategoryService shopCategoryService;
@Test
public void testGetShopCategoryList() {
List<ShopCategory> shopCategorys=null;
shopCategorys=shopCategoryService.getShopCategoryList(null);
shopCategorys.addAll(shopCategoryService.getShopCategoryList(new ShopCategory()));
System.out.println(shopCategorys.size());
System.out.println(shopCategorys.get(1).getParent().getShopCategoryId());
}
}
按照源码空值到后台页面就报错
正在回答
同学你好,报出的错误信息是什么呐,还麻烦同学将具体的报错信息贴出,便于老师定位问题。
如果我的回答解决了你的疑惑,请采纳,祝学习愉快~
- 参与学习 人
- 提交作业 323 份
- 解答问题 8263 个
本阶段将带你学习主流框架SSM,以及SpringBoot ,打通成为Java工程师的最后一公里!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星