Examples of DefaultBeanClass


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

  @Test
  public void shouldReturnWantedUrlWithoutArgs() throws Throwable {
    when(router.urlFor(TestController.class, anotherMethod, new Object[2])).thenReturn("/expectedURL");

    //${linkTo[TestController].anotherMethod()}
    String uri = invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod");
    assertThat(uri, is("/path/expectedURL"));
  }
View Full Code Here

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

  @Test
  public void shouldReturnWantedUrlWithoutArgsUsingPropertyAccess() throws Throwable {
    when(router.urlFor(TestController.class, anotherMethod, new Object[2])).thenReturn("/expectedURL");

    //${linkTo[TestController].anotherMethod}
    String uri = invoke(handler.get(new DefaultBeanClass(TestController.class)), "getAnotherMethod");
    assertThat(uri, is("/path/expectedURL"));
  }
View Full Code Here

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

  public void shouldReturnWantedUrlWithParamArgs() throws Throwable {
    String a = "test";
    int b = 3;
    when(router.urlFor(TestController.class, method2params, new Object[]{a, b})).thenReturn("/expectedURL");
    //${linkTo[TestController].method('test', 3)}
    String uri = invoke(handler.get(new DefaultBeanClass(TestController.class)), "method", a, b);
    assertThat(uri, is("/path/expectedURL"));
  }
View Full Code Here

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

  @Test
  public void shouldReturnWantedUrlWithPartialParamArgs() throws Throwable {
    String a = "test";
    when(router.urlFor(TestController.class, anotherMethod, new Object[]{a, null})).thenReturn("/expectedUrl");
    //${linkTo[TestController].anotherMethod('test')}
    String uri = invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod", a);
    assertThat(uri, is("/path/expectedUrl"));
  }
View Full Code Here

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

  @Test
  public void shouldReturnWantedUrlForOverrideMethodWithParamArgs() throws Throwable {
    String a = "test";
    when(router.urlFor(SubGenericController.class, SubGenericController.class.getDeclaredMethod("method", new Class[]{String.class}), new Object[]{a})).thenReturn("/expectedURL");
    //${linkTo[TestSubGenericController].method('test')}]
    String uri = invoke(handler.get(new DefaultBeanClass(SubGenericController.class)), "method", a);
    assertThat(uri, is("/path/expectedURL"));
  }
View Full Code Here

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

  @Test
  public void shouldReturnWantedUrlForOverrideMethodWithParialParamArgs() throws Throwable {
    String a = "test";
    when(router.urlFor(SubGenericController.class, SubGenericController.class.getDeclaredMethod("anotherMethod", new Class[]{String.class, String.class}), new Object[]{a, null})).thenReturn("/expectedURL");
    //${linkTo[TestSubGenericController].anotherMethod('test')}]
    String uri = invoke(handler.get(new DefaultBeanClass(SubGenericController.class)), "anotherMethod", a);
    assertThat(uri, is("/path/expectedURL"));
  }
View Full Code Here

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

  @Test
  public void shouldUseExactlyMatchedMethodIfTheMethodIsOverloaded() throws Throwable {
    String a = "test";
    when(router.urlFor(TestController.class, method1param, a)).thenReturn("/expectedUrl");
    //${linkTo[TestController].method('test')}
    String uri = invoke(handler.get(new DefaultBeanClass(TestController.class)), "method", a);
    assertThat(uri, is("/path/expectedUrl"));
  }
View Full Code Here

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

    String a = "test";
    int b = 3;
    String c = "anotherTest";
    //${linkTo[TestController].anotherMethod('test', 3, 'anotherTest')}
    try {
      invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod", a, b, c);
      fail();
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage().toLowerCase(), startsWith("wrong number of arguments"));
    }
  }
View Full Code Here

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

    when(context1.getContextPath()).thenReturn("/another");

    LinkToHandler handler0 = new LinkToHandler(context0, router, new JavassistProxifier());
    LinkToHandler handler1 = new LinkToHandler(context1, router, new JavassistProxifier());

    Object object0 = handler0.get(new DefaultBeanClass(TestController.class));
    assertThat(object0.getClass().getName(), containsString("$linkTo_$$"));

    Object object1 = handler1.get(new DefaultBeanClass(TestController.class));
    assertThat(object1.getClass().getName(), containsString("$linkTo$another_$$"));
  }
View Full Code Here

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

    jsonDeserializers.add(new CalendarGsonConverter());
    jsonDeserializers.add(new DateGsonConverter());

    builder = new GsonBuilderWrapper(new MockInstanceImpl<>(jsonSerializers), new MockInstanceImpl<>(jsonDeserializers), new Serializee());
    deserializer = new GsonDeserialization(builder, provider, request, container, deserializeeInstance);
    BeanClass controllerClass = new DefaultBeanClass(DogController.class);

    noParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("noParameter"));
    dogParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dogParameter", Dog.class));
    dateParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dateParameter", Date.class));
    dogAndIntegerParameter = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dogAndIntegerParameter", Dog.class,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.