英文:
Error:The method assertEquals(String, String) is undefined for the type Object
问题
即使在导入了import static org.junit.Assert.*;
之后,仍然会得到以下错误:
错误:对类型Object未定义方法assertEquals(String, String)。
英文:
Even after imported import static org.junit.Assert.*;getting below error
Error:The method assertEquals(String, String) is undefined for the type Object
答案1
得分: 0
我在添加了代码后遇到了相同的问题
import static org.junit.Assert.*;
但我尝试了这个静态导入
org.junit.jupiter.api.Assertions.assertEquals;
对我有用。
英文:
I had the same issue after adding code
import static org.junit.Assert.*;
but I tried with this import static
org.junit.jupiter.api.Assertions.assertEquals;
it worked for me.
专注分享java语言的经验与见解,让所有开发者获益!
评论