Import Madness


Do you know the intersection between the Google Collections API and TestNG? Both APIs contain a class Lists with two identical methods newArrayList(). No problem so far, but you should really pay attention which one to import. If you set up your project with Maven2 it’s best practice to use the test scope on each test-specific dependency. That means wrongly importing org.testng.v6.Lists in productive code would leed to some weird compiler errors on running the build scripts. So pay attention to import com.google.common.collect.Lists instead of the one from the TestNG API.

Read More