Testng: ITestListener - Add unimplemeted methods missing in eclipse for

Created on 27 Nov 2018  路  8Comments  路  Source: cbeust/testng

TestNG Version - 7.0.0-beta1

Note: only the latest version is supported

Expected behavior

When the ITestListener or any other listener gets implemented eclipse should show add unimplemented methods option, when clicked on the option all the methods of the interface should included the class

Actual behavior

Its not working as expected behavior
screenshot

Is the issue reproductible on runner?

  • [x] Maven
  • [x] Eclipse

Test case sample

package com.freecrm.ExtentReportListener;
import org.testng.ITestListener;
public class MyListener implements ITestListener{
image

}

Most helpful comment

@sen1983 - 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.

All 8 comments

@sen1983 - 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.

@krmahadevan - Thank you for the answer, adding more info to it.

When you are not able to add the unimplemented methods, start writing the code but do not add "@override".

@sagaramritkar - Not sure what do you mean and what you were trying to explain. Care to explain one more time ?

@sagaramritkar Agreed with your statement when I am adding the default method

[ default void onTestFailure(ITestResult result) {
// not implemented
} ]
with "@override" it's giving me an error with a quick fix --> "Remove @Override annotation"

@krmahadevan Please verify

image

This issue belongs to TestNG 7.1.0. try to configure TestNG 6.14.3. Issue will not reproduce.

is this an issue or change ?

@prernabhandari2427 - Not sure what you mean by that.

This issue belongs to TestNG 7.1.0. try to configure TestNG 6.14.3. Issue will not reproduce.

Thanks, it works

Was this page helpful?
0 / 5 - 0 ratings