Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assertTrue statement requires static import in intelliJ IDEA?

I just shifted my project form Netbeans to intelliJ IDEA, its a junit based test project. In netbeans I was using statments

assertTrue("Message", conditionCustom());

and it was working without any extra import. Now when using the same above command in intelliJ I have to import file

import static org.junit.Assert.assertTrue;

is there any way so I dont need to write the above line in my code file? otherwise I have to edit all my files to get working assertTrue statement.

like image 782
coure2011 Avatar asked Apr 25 '13 11:04

coure2011


1 Answers

You either have to add the static import OR make clear what class that static call is associated with:

Assert.assertTrue("Message", conditionCustom());

I usually use the latter because I think it's clearer.

Java won't compile unless it can figure out which class to associate that static method with.

I'd guess that perhaps you use inheritance to associate that static method with your test.

like image 196
duffymo Avatar answered Sep 28 '22 14:09

duffymo