错误:方法assertEquals(String,String)在类型Object上未定义

huangapple 未分类评论73阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年4月9日 14:24:43
  • 转载请务必保留本文链接:https://java.coder-hub.com/61115131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定