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

Both are depricated:

junit.framework.Assert.assertThat
org.junit.Assert.assertThat

According to docs, use Instead:

org.hamcrest.MatcherAssert.assertThat

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.


Change your import statement from

import junit.framework.Assert;

to

import org.junit.Assert; 

and this will rectify your JUnit deprecation warnings.

Tags:

Junit

Junit4