I am trying to mock the controller class with some endpoints annotated with @CrossOrigin. it is giving this exception.
Caused by: java.lang.IllegalAccessException: Class net.bytebuddy.description.annotation.AnnotationDescription$ForLoadedAnnotation can not access a member of class org.springframework.web.bind.annotation.CrossOrigin with modifiers "private static"
@Runwith(PowerMockRunner.class)
class TestDemo
{
@Mock
private ControllerTest con;
}
class ControllerTest
{
@CrossOrigin
@RequestMapping
public void testCon()
{
//code implementation
}
}