java - 警告 : The method assertEquals from the type Assert is deprecated

标签 java junit

由于方法 Assert.assertEquals 已被弃用,我们现在应该使用哪种方法?

以下代码:

String arg1 = "test";
String arg2 = "me";

Assert.assertEquals(arg1, arg2);

给出以下警告:

Multiple markers at this line

  • The method assertEquals(String, String) from the type Assert is deprecated
  • The type Assert is deprecated

最佳答案

您正在使用 junit.framework.Assert 而不是 org.junit.Assert

关于java - 警告 : The method assertEquals from the type Assert is deprecated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22541455/

相关文章:

java - Kotlin 类作为 junit 测试运行,即使它在 androidTest 包中 - 对于 Java 类它正常运行

java - @RequestMapping java.lang.AssertionError : Status Expected :200 Actual :404

Java:如何从其他程序中获取值?

java - 如何处理Spring Boot注释中的403禁止错误?

java - 无法从 openjfx 源代码和设置构建 SceneBuild

java - 返回今天前N天的测试方法

java - Eclipse:如何导入 VM Arg 变量?

java - 为什么我们需要针对普通 POJO 运行测试用例

java - 使用 Java Servlet 访问 post 变量

java - Spring Data JPA连接2个表