Some benchmarks are called as unit tests in our current code base. They should be called from main methods, because:
1. This is the recommended way of writing JMH benchmarks. The automatically generated benchmarks are called from main, and sample benchmarks provided by JMH  are also called from main.
2. Some compiler does not support calling JMH as unit test. For example, the "javac with error prone" reports the following error:
Error:(100, 15) java: [JUnit4TearDownNotRun] tearDown() method will not be run; please add JUnit's @After annotation
Did you mean '@After'?
3. When run as a unit test, enable assert flag will be turned on by default, so some test/debug operations will be performed. This will distort the benchmark result data. For example, a related discussion can be found in .