Package br.com.caelum.vraptor.interceptor.example

Examples of br.com.caelum.vraptor.interceptor.example.MethodLevelAcceptsController


 

  @Test
  public void shouldAcceptMethodWithAnnotation() throws Exception {
    WithAnnotationAcceptor acceptor = new WithAnnotationAcceptor();   
    DefaultControllerInstance controllerInstance = new DefaultControllerInstance(new MethodLevelAcceptsController());
    AnnotationLiteral<NotLogged> notLogged = new AnnotationLiteral<NotLogged>() {};
   
    acceptor.initialize(annotation);
   
    when(controllerMethod.getAnnotations()).thenReturn(new Annotation[]{notLogged});
View Full Code Here


  }
 
  @Test
  public void shouldNotAcceptMethodWithoutAnnotation() throws Exception {
    WithAnnotationAcceptor acceptor = new WithAnnotationAcceptor();
    DefaultControllerInstance controllerInstance = new DefaultControllerInstance(new MethodLevelAcceptsController());
   
    acceptor.initialize(annotation);
   
    when(controllerMethod.getAnnotations()).thenReturn(new Annotation[]{});
   
View Full Code Here

        withAnnotationAcceptor);

    when(withAnnotationAcceptor.validate(Mockito.same(controllerMethod),
      Mockito.any(ControllerInstance.class))).thenReturn(true);

    aspectHandler.execute(stack, controllerMethod, new MethodLevelAcceptsController());

    assertTrue(interceptor.isBeforeCalled());
    assertTrue(interceptor.isInterceptCalled());
    assertTrue(interceptor.isAfterCalled());
View Full Code Here

      InterceptorWithCustomizedAccepts.class, interceptor,withAnnotationAcceptor);

    when(withAnnotationAcceptor.validate(Mockito.same(controllerMethod),
        Mockito.any(ControllerInstance.class))).thenReturn(false);

    aspectHandler.execute(stack, controllerMethod, new MethodLevelAcceptsController());

    assertFalse(interceptor.isBeforeCalled());
    assertFalse(interceptor.isInterceptCalled());
    assertFalse(interceptor.isAfterCalled());
  }
View Full Code Here

  @Before
  public void setup() {
    MockitoAnnotations.initMocks(this);
    interceptor = new InterceptorWithCustomizedAccepts();
    controllerInstance = new DefaultControllerInstance(new MethodLevelAcceptsController());
    constraints = getCustomAcceptsAnnotations(interceptor.getClass());
    when(withAnnotationAcceptor.validate(controllerMethod, controllerInstance)).thenReturn(true);
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.interceptor.example.MethodLevelAcceptsController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.