更新时间:2023-08-29 18:35:04
你在调用测试方法时使用mockito anyString()
,它应该只用于验证mock对象以确保使用测试中的任何字符串参数调用某个方法,但不调用测试本身.对于您的测试,请使用空字符串 ""
而不是 anyString()
.
You are using mockito anyString()
while calling the test method, it should be used only for verifying a mock object to ensure a certain method is called with any string parameter inside the test, but not to invoke the test itself. For your test use empty string ""
instead to anyString()
.