I am working on Selenium with Java and using Listeners.
I created the class, imported the TestNG, and then added method as;
Public class Listener implements ITestListener{
}
I got an error at "ITestListner" and then imported "ITestListner(org.testng). After this it was expected that I will get an error for "Listener" but I didn't get any error.
I tried creating with abstract class but still didn't get the error.
package com.testng;
import org.testng.ITestListener;
public class Listeners implements ITestListener{
}
The expectation is when I move the cursor over "Listeners" I should get "Add unimplemented methods" option.
Right click(on the Listeners class ) -> go to source-> click on overide/implement methods -> select the check boxes for the ITest listener (make sure all check box inside it should be checked )->click on oK. That's it !!!
As i got to know from the below link - TestNG 7.0.0 uses JDK8 and with it default methods within interfaces. What this means is that every listener would now have a default implementation (which doesn't do anything ) for all methods defined within the interface.
So now you won't see those indications from the IDE. The biggest benefit of default methods in interfaces is that let's say you are implementing an interface that has 10 methods defined in it, you can just implement whatever you need and the rest of the behavior comes via the default methods in the interface. Reference- https://github.com/cbeust/testng/issues/1964
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With