Package br.com.caelum.vraptor.resource

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass


  }


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

    assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withAbsolutePath"));
  }
View Full Code Here


  }


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

    assertThat(route, canHandle(GetAnnotatedController.class, "withAbsolutePath"));
  }
View Full Code Here

    assertThat(route, canHandle(GetAnnotatedController.class, "withAbsolutePath"));
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerIsAnnotatedWithPath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/withoutPath");

    assertThat(route, canHandle(GetAnnotatedController.class, "withoutPath"));
  }
View Full Code Here

    assertThat(route, canHandle(GetAnnotatedController.class, "withoutPath"));
  }

  @Test(expected=IllegalArgumentException.class)
  public void throwsExceptionWhenTheGetControllerHasAmbiguousDeclaration() throws Exception {
    parser.rulesFor(new DefaultResourceClass(WrongGetAnnotatedController.class));
  }
View Full Code Here

  }

  private void registerRulesFor(Class<?> type) {
    RoutesParser parser = new PathAnnotationRoutesParser(router);
   
    ResourceClass resourceClass = new DefaultResourceClass(type);
    List<Route> rules = parser.rulesFor(resourceClass);
    for (Route route : rules) {
      router.add(route);
    }
  }
View Full Code Here

    }
  }

  @Test(expected = IllegalArgumentException.class)
  public void addsAPrefixToMethodsWhenTheControllerHasMoreThanOneAnnotatedPath() throws Exception {
    parser.rulesFor(new DefaultResourceClass(MoreThanOnePathAnnotatedController.class));
  }
View Full Code Here

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

  @Test
  public void addsAPrefixToMethodsWhenTheControllerAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(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 DefaultResourceClass(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 DefaultResourceClass(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 DefaultResourceClass(EndSlashAnnotatedController.class));
    Route route = getRouteMatching(routes, "/endSlash/");

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

  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.resource.DefaultResourceClass

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.