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

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


  }

  @Test
  public void shouldAcceptCustomizedAccepts() throws Exception {

    InterceptorWithCustomizedAccepts interceptor = new InterceptorWithCustomizedAccepts();

    AspectStyleInterceptorHandler aspectHandler = newAspectStyleInterceptorHandler(
        InterceptorWithCustomizedAccepts.class, interceptor,
        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


  }

  @Test
  public void shouldNotAcceptCustomizedAccepts() throws Exception {
    InterceptorWithCustomizedAccepts interceptor = new InterceptorWithCustomizedAccepts();
    AspectStyleInterceptorHandler aspectHandler = newAspectStyleInterceptorHandler(
      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

    assertFalse(interceptor.isAfterCalled());
  }

  @Test
  public void shouldInvokeCustomAcceptsFailCallback() {
    InterceptorWithCustomizedAccepts interceptor = spy(new InterceptorWithCustomizedAccepts());
    AspectStyleInterceptorHandler aspectHandler = newAspectStyleInterceptorHandler(
        InterceptorWithCustomizedAccepts.class, interceptor,
        withAnnotationAcceptor);

    when(withAnnotationAcceptor.validate(Mockito.same(controllerMethod),
View Full Code Here

  private List<Annotation> constraints;

  @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.InterceptorWithCustomizedAccepts

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.