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
Vincent Partington
Our Ideas
Explore More Blogs

Where the GitHub Copilot Extension Points Break Governance
A lot of the recent additions to the GitHub Copilot ecosystem add real value for individual developers, yet they also expand the security surface that...
Rob Bos
Contact


