Package br.com.caelum.vraptor.core

Examples of br.com.caelum.vraptor.core.DefaultMethodInfo


  @Before
  public void setup() {
    MockitoAnnotations.initMocks(this);
    method = DefaultResourceMethod.instanceFor(AnyResource.class, AnyResource.class.getDeclaredMethods()[0]);
    proxifier = new JavassistProxifier(new ObjenesisInstanceCreator());
    requestInfo = new DefaultMethodInfo();
    requestInfo.setResourceMethod(method);
    fixedResolver = new PathResolver() {
      public String pathFor(ResourceMethod method) {
        return "fixed";
      }
View Full Code Here


  @Before
  public void setup() {
  MockitoAnnotations.initMocks(this);

  proxifier = new JavassistProxifier(new ObjenesisInstanceCreator());
  methodInfo = new DefaultMethodInfo();
    this.logicResult = new DefaultLogicResult(proxifier, router, request, response, container,
    resolver, extractor, flash, methodInfo);
  }
View Full Code Here

  }

  @Test
  public void shouldValidateMethodWithConstraint()
  throws Exception {
  MethodInfo info = new DefaultMethodInfo();
  info.setParameters(new Object[] { null });
  info.setResourceMethod(withConstraint);

  interceptor = new MethodValidatorInterceptor(l10n, interpolator, validator, info, factory.getValidator(), provider);
  when(l10n.getLocale()).thenReturn(new Locale("pt", "br"));

  MyController controller = new MyController();
  interceptor.intercept(stack, info.getResourceMethod(), controller);
 
  assertThat(validator.getErrors(), hasSize(1));
  assertThat(validator.getErrors().get(0).getCategory(), is("withConstraint.email"));
  }
View Full Code Here

  }

  @Test
  public void shouldUseDefaultLocale()
  throws Exception {
  MethodInfo info = new DefaultMethodInfo();
  info.setParameters(new Object[] { null });
  info.setResourceMethod(withConstraint);

  interceptor = new MethodValidatorInterceptor(l10n, interpolator, validator, info, factory.getValidator(), provider);

  MyController controller = new MyController();
  interceptor.intercept(stack, info.getResourceMethod(), controller);

  assertThat(validator.getErrors(), hasSize(1));
  assertThat(validator.getErrors().get(0).getCategory(), is("withConstraint.email"));
  assertThat(validator.getErrors().get(0).getMessage(), is("may not be null"));
  }
View Full Code Here

  }

  @Test
  public void shouldValidateMethodWithTwoConstraints()
  throws Exception {
  MethodInfo info = new DefaultMethodInfo();
  info.setParameters(new Object[] { null, new Customer(null, null) });
  info.setResourceMethod(withTwoConstraints);

  interceptor = new MethodValidatorInterceptor(l10n, interpolator, validator, info, factory.getValidator(), provider);
  when(l10n.getLocale()).thenReturn(new Locale("pt", "br"));

  MyController controller = new MyController();
  interceptor.intercept(stack, info.getResourceMethod(), controller);
  String messages = validator.getErrors().toString();

  assertThat(validator.getErrors(), hasSize(3));
 
  assertThat(messages, containsString("não pode ser nulo"));
View Full Code Here

  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    methodInfo = new DefaultMethodInfo();
    interceptor = new DeserializingInterceptor(request, deserializers, methodInfo, container, status);
    consumeXml = new DefaultResourceMethod(null, DummyResource.class.getDeclaredMethod("consumeXml"));
    doesntConsume = new DefaultResourceMethod(null, DummyResource.class.getDeclaredMethod("doesntConsume"));
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.core.DefaultMethodInfo

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.