assertTrue statement requires static import in intelliJ IDEA?

20,942

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.

Share:
20,942
coure2011
Author by

coure2011

Updated on October 18, 2020

Comments

  • coure2011
    coure2011 over 3 years

    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.