Java – unable to import org.xml junit. Assert. AssertThat;

I can't import org. In my program junit. Assert. AssertThat. I use Ganymede and JUnit 4.8 one

Solution

Static import

It's org junit. Assert. Assertthat (T, matcher < T >), you can import it as a static import:

import static org.junit.Assert.assertThat

Now in your client code, you can do assert that (something, ismatched ())

Reference: Java Tutorial > the static import statement

Regular import

To do this old-fashioned method, if you import the assert class like this

import org.junit.Assert

You can use assert Assert that (something, ismatched()) to call it

(the ismatched () method is what you must implement)

assertThat()

Assertthat() is first described as in this blog post and has become part of JUnit ever since version 4.4, so please ensure that you have JUnit version 4.4 or higher on your classpath Also, make sure your compiler compliance level is 1.5 or higher:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>