Package br.com.caelum.vraptor.controller

Examples of br.com.caelum.vraptor.controller.DefaultBeanClass


  }

  @Test
  public void shouldDeserializeFromGenericTypeOneParam() {
    InputStream stream = asStream("{'entity':{'name':'Brutus','age':7,'birthday':'2013-07-23T17:14:14-03:00'}}");
    BeanClass resourceClass = new DefaultBeanClass(DogGenericController.class);
    Method method = new Mirror().on(DogGenericController.class).reflect().method("method").withAnyArgs();
    ControllerMethod resource = new DefaultControllerMethod(resourceClass, method);
   
    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here


  }

  @Test
  public void shouldDeserializeFromGenericTypeTwoParams() {
    InputStream stream = asStream("{'entity':{'name':'Brutus','age':7,'birthday':'2013-07-23T17:14:14-03:00'}, 'param': 'test', 'over': 'value'}");
    BeanClass resourceClass = new DefaultBeanClass(DogGenericController.class);
    Method method = new Mirror().on(DogGenericController.class).reflect().method("anotherMethod").withAnyArgs();
    ControllerMethod resource = new DefaultControllerMethod(resourceClass, method);
   
    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

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

    provider = new ParanamerNameProvider();
   
    method = new DefaultControllerMethod(new DefaultBeanClass(MyResource.class), MyResource.class.getMethod(
        "method", String.class, Integer.class, BigDecimal.class));

    proxifier = new JavassistProxifier();
    typeFinder = new DefaultTypeFinder(provider);
  }
View Full Code Here

  @Test
  public void addsAPrefixToMethodsWhenTheControllerHasMoreThanOneAnnotatedPath() throws Exception {
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("You must specify exactly one path on @Path at class " + MoreThanOnePathAnnotatedController.class.getName());
   
    parser.rulesFor(new DefaultBeanClass(MoreThanOnePathAnnotatedController.class));
  }
View Full Code Here

    parser.rulesFor(new DefaultBeanClass(MoreThanOnePathAnnotatedController.class));
  }

  @Test
  public void addsAPrefixToMethodsWhenTheControllerAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(PathAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/relativePath");

    assertThat(route, canHandle(PathAnnotatedController.class, "withRelativePath"));

  }
View Full Code Here

  }

  @Test
  public void addsAPrefixToMethodsWhenTheControllerEndsWithSlashAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedController.class));
    Route route = getRouteMatching(routes, "/endSlash/relativePath");

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withRelativePath"));

  }
View Full Code Here

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withRelativePath"));

  }
  @Test
  public void addsAPrefixToMethodsWhenTheControllerEndsWithSlashAndTheMethodAreAnnotatedWithAbsolutePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedController.class));
    Route route = getRouteMatching(routes, "/endSlash/absolutePath");

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withAbsolutePath"));

  }
View Full Code Here

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withAbsolutePath"));

  }
  @Test
  public void addsAPrefixToMethodsWhenTheControllerEndsWithSlashAndTheMethodAreAnnotatedWithEmptyPath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedController.class));
    Route route = getRouteMatching(routes, "/endSlash/");

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withEmptyPath"));

  }
View Full Code Here

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withEmptyPath"));

  }
  public void addsAPrefixToMethodsWhenTheControllerEndsWithSlashAndTheMethodAreNotAnnotated() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedController.class));
    Route route = getRouteMatching(routes, "/endSlash/withoutPath");

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withoutPath"));

  }
View Full Code Here

    assertThat(route, canHandle(EndSlashAnnotatedController.class, "withoutPath"));

  }
  @Test
  public void addsAPrefixToMethodsWhenTheControllerAndTheMethodAreAnnotatedWithAbsolutePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(PathAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/absolutePath");

    assertThat(route, canHandle(PathAnnotatedController.class, "withAbsolutePath"));

View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.controller.DefaultBeanClass

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.