Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Assert in junit.framework has been deprecated" - what next to use?

Tags:

junit

junit4

I bump version of junit to 4.11 and get:

[WARNING] [deprecation] Assert in junit.framework has been deprecated
[WARNING] [deprecation] Assert in junit.framework has been deprecated
....

How and to what migrate?

like image 556
gavenkoa Avatar asked Oct 11 '22 02:10

gavenkoa


People also ask

Is JUnit deprecated?

framework to org. junit. Assert in JUnit 4.0 - you can use that instead, it's not deprecated.

What can I use instead of assertThat?

assertThat method defined in Hamcrest 1.3. Therefore, it is recommended to directly use the equivalent assertion defined in the third party Hamcrest library. This rule finds the deprecated usages of Assert. assertThat and automatically replaces them with MatcherAssert.

What is assert fail in JUnit?

junit. Assert class. The fail assertion fails a test throwing an AssertionError. It can be used to verify that an actual exception is thrown or when we want to make a test failing during its development.


1 Answers

As it seems the Assert class has been moved from junit.framework to org.junit.Assert in JUnit 4.0 - you can use that instead, it's not deprecated.

like image 258
Alex Stockinger Avatar answered Oct 16 '22 12:10

Alex Stockinger