How to mock the @ value using power mock not with Mockito?

问题描述 投票:0回答:0

需要使用power mockito 设置服务类的@Value,而不是使用Mockito。 尝试使用 Reflection.utils(class , name , value) 设置值它不起作用,因为该类正在使用 PowerMockRunner.class.

@Value("#'{test.codes}'") 私有列表测试列表;

应用-yml

测试: 代码:005

spring spring-boot powermock
© www.soinside.com 2019 - 2024. All rights reserved.