Closed. This question needs details or clarity . It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post .
Closed 16 hours ago.
Improve this question
How to write test cases for @Value variables?
I am trying to write test cases for a method which has an String array which is initialized using @Value.
And when I am writing test case for the same method I am getting an nullpointerexception.
Which is the right way to write test cases for such types?
1条答案
按热度按时间bhmjp9jg1#
您可以在模拟对象中注入
org.springframework.test.util.ReflectionTestUtils
的价值