Test Development with TestNG and Maven
Update following the discussion in the comments:
The reason for not running/debugging my tests from within Netbeans is because the Netbeans TestNG plugin is not up-to-date. I’m using TestNG 5.5 while the plugin is written for 4.6 or something like that. I’m sure that if I’m using either Eclipse with TestNG or JUnit with Netbeans, the [...]
Current Class and Method
Current class is easy:
String currentClass() {
return this.getClass().getSimpleName();
}
Current method:
String currentMethod() {
return Thread.currentThread().getStackTrace()[3].getMethodName();
}
The number in the stack trace changes depending on how far down you bury this call.
Really handy for unit testing or debug logging (remember to wrap debug logging with [...]