Blog
Eclipse Tip: Keep static imports for JUnit 4
If you are using Eclipse to write your JUnit 4 tests you might have noticed that when you organize the imports, the line
import static org.junit.Assert.*;
at the top of your JUnit 4 classes is replaced by stuff like:
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
While your code still compiles and runs OK, this forces you to add another specific static import every time you want to use another static assert method like assertEquals. Luckily this can be fixed by going to Windows/Preferences..., going to the Java/Code Style/Organize Imports tab and then entering 1 where it says "Number of static imports needed for .*" and then clicking the OK button. Hope this helps!
Written by
Our Ideas
Explore More Blogs

Using OutSystems UI Components in the right way
Using OutSystems UI Components in the right way Using OutSystems UI Components in the right way can be a game-changer for developers who want...
Vanessa William

OutSystems – Versioning Control
OutSystems – Versioning Control There are two widely used methodologies for versioning code: the traditional Branching methodology, and the...
Vanessa William
Contact












