javatestngtestng-eclipse

The method compareTo(ITestNGMethod) is undefined for the type ITestNGMethod


I've existing automation framework which I imported in eclipse and in one of the class files, it has following code which is inside a class -

    // ~ Inner Classes --------------------------------------------------------
/** Arranges methods by classname and method name */
private class TestSorter implements Comparator<IInvokedMethod> {
    // ~ Methods
    // -------------------------------------------------------------

    /** Arranges methods by classname and method name */
    @SuppressWarnings("unchecked")
    @Override
    public int compare(IInvokedMethod o1, IInvokedMethod o2) {
        int r = o1.getTestMethod().getTestClass().getName().compareTo(o2.getTestMethod().getTestClass().getName());

        if (r == 0) {
            r = o1.getTestMethod().compareTo(o2.getTestMethod());
        }
        return r;
    }
}

but it shows following TestNG related compilation error - The method compareTo(ITestNGMethod) is undefined for the type ITestNGMethod

Other guys on my team don't see this issue, but I do. Can someone please help to understand what could wrong here and how to resolve this?


Solution

  • Somehow the issue is resolved after removing TestNG library from - right click project -> Properties -> Libraries.

    Might be some issue with TestNG version mismatch between added library and installed TestNG plugin.