0

I am getting error: java.lang.NoSuchMethodException:

here is my code

public class ManageEnrollmentTest {
    @Test
    public void Test_Filter_By_Active() throws Exception{

        assertTrue("Log in failed", Helper.LoginTest());

        assertTrue("Activation failed", fitlerResults("Active"));

    }

    private Boolean fitlerResults(String dS){
        Boolean isOk = false;
        try{
            JavascriptExecutor js = (JavascriptExecutor)driver;
            js.executeScript("$('#dType').val('36').change().trigger(\"liszt:updated\");;");

            WebElement findButton = driver.findElement(By.id("findDealersBtn"));
            findButton.click();

            Method method = ManageEnrollmentTest.class.getMethod("verifyActive");           //////// Error
            isOk = loadEnrollmentTablePageByPageAndVerify(method);
        }
        catch(Exception e){
            e.printStackTrace();
            isOk = false;
        }
        return isOk;
    }

    private Boolean loadEnrollmentTablePageByPageAndVerify(Method method){
        return (Boolean)method.invoke(this);
    }

    //browse throw all dealers that are currently on page
    private Boolean verifyActive(){
        ....
        ....
        return isOk;
    }
}
1
  • 1
    where does your error point to? Commented Apr 28, 2013 at 7:05

1 Answer 1

3

Your method is private but getMethod() only returns public method.You need to use getDeclaredMethod().

getMethod() - Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.