package uk.co.littlemike.jextend.impl.jdk;

import org.junit.Test;

public class MethodLookupTest {

    private void privateMethod() {
    }

    @Test(expected = MethodLookupException.class)
    public void throwsExceptionWhenAttemptingToLookupPrivateMethod() throws Exception {
        MethodLookup lookup = new MethodLookup(Object.class);

        lookup.lookup(MethodLookupTest.class.getDeclaredMethod("privateMethod"));
    }
}

@@ -252,16 +252,32 @@
 teMethod
+OnDifferentClass
 () throw
@@ -440,11 +440,361 @@
 );%0A    %7D
+%0A%0A    @Test(expected = MethodLookupException.class)%0A    public void throwsExceptionWhenAttemptingToLookupPrivateMethodOnDifferentClass_EvenIfPrivileged() throws Exception %7B%0A        PrivilegedMethodLookup lookup = new PrivilegedMethodLookup(Object.class);%0A%0A        lookup.lookupDefault(MethodLookupTest.class.getDeclaredMethod(%22privateMethod%22));%0A    %7D
 %0A%7D%0A

Add test for privileged private method lookup failure