Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITestListener - Add unimplemeted methods missing in eclipse for #1964

Closed
2 tasks done
ghost opened this issue Nov 27, 2018 · 10 comments
Closed
2 tasks done

ITestListener - Add unimplemeted methods missing in eclipse for #1964

ghost opened this issue Nov 27, 2018 · 10 comments

Comments

@ghost
Copy link

ghost commented Nov 27, 2018

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?

  • Maven
  • Eclipse

Test case sample

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

}

@krmahadevan
Copy link
Member

krmahadevan commented Nov 27, 2018

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

@sagaramritkar
Copy link

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

@krmahadevan
Copy link
Member

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

@Abhi6692
Copy link

Abhi6692 commented Nov 2, 2019

@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

@pranayKumarPK
Copy link

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

@prernabhandari2427
Copy link

is this an issue or change ?

@krmahadevan
Copy link
Member

@prernabhandari2427 - Not sure what you mean by that.

@SunilGithub1
Copy link

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

Thanks, it works

@Gulshanlc
Copy link

@pranayKumarPK
@SunilGithub1
Thanks, I changed to TestNG 6,.14.3, and the problem was resolved.
@krmahadevan
Thanks for explaining reason

@VishKC
Copy link

VishKC commented Sep 24, 2023

Right click on the class --> select source --> choose override/implement methods --> then pick the methods you'd like to implement.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants