Package net.vidageek.mirror.dsl

Examples of net.vidageek.mirror.dsl.Mirror


    }
  }
  @Test
  public void shouldGetTypesCorrectly() throws Exception {

    final Method method = new Mirror().on(AController.class).reflect().method("aMethod").withArgs(Bean.class, String.class);
    when(provider.parameterNamesFor(method)).thenReturn(new String[] {"bean", "path"});
   
    DefaultTypeFinder finder = new DefaultTypeFinder(provider);
    Map<String, Class<?>> types = finder.getParameterTypes(method, new String[] {"bean.bean2.id", "path"});
View Full Code Here


    assertEquals(Integer.class, types.get("bean.bean2.id"));
    assertEquals(String.class, types.get("path"));
  }
  @Test
  public void shouldGetTypesCorrectlyOnInheritance() throws Exception {
    final Method method = new Mirror().on(AController.class).reflect().method("otherMethod").withArgs(BeanExtended.class);
   
    when(provider.parameterNamesFor(method)).thenReturn(new String[] {"extended"});
   
    DefaultTypeFinder finder = new DefaultTypeFinder(provider);
    Map<String, Class<?>> types = finder.getParameterTypes(method, new String[] {"extended.id"});
View Full Code Here

    when(localization.getBundle()).thenReturn(bundle);
    when(request.getParameterNames()).thenReturn(Collections.enumeration(Collections.EMPTY_LIST));

  this.instantiator = new ParametersInstantiatorInterceptor(parametersProvider, parameterNameProvider, params, validator, localization, request, flash);

  this.errors = (List<Message>) new Mirror().on(instantiator).get().field("errors");
  this.method = DefaultResourceMethod.instanceFor(Component.class, Component.class.getDeclaredMethod("method"));
  this.otherMethod = DefaultResourceMethod.instanceFor(Component.class, Component.class.getDeclaredMethod("otherMethod", int.class));
  }
View Full Code Here

  public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  this.handler = new LinkToHandler(context, router);
  when(context.getContextPath()).thenReturn("/path");

  this.method2params = new Mirror().on(TestController.class).reflect().method("method").withArgs(String.class, int.class);
  this.method1param = new Mirror().on(TestController.class).reflect().method("method").withArgs(String.class);
  this.anotherMethod = new Mirror().on(TestController.class).reflect().method("anotherMethod").withArgs(String.class, int.class);
  }
View Full Code Here

  }

  @Test
  public void shouldBeAbleToReceiveListsOfSerializationsAsDependency() throws Exception {
    RepresentationResult instance = getFromContainer(RepresentationResult.class);
    Collection serializations = (Collection) new Mirror().on(instance).get().field("serializations");
    assertFalse(serializations.isEmpty());
  }
View Full Code Here

      public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) {
        Assert.fail("should not call this Method interceptor");
        return null;
      }
    });
    new Mirror().on(proxy).invoke().method("finalize").withoutArgs();
  }
View Full Code Here

    public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) {
    fail("should not call this Method interceptor");
    return null;
    }
  });
  new Mirror().on(proxy).invoke().method("finalize").withoutArgs();
  }
View Full Code Here

    public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) {
    fail("should not call this Method interceptor");
    return null;
    }
  });
  new Mirror().on(proxy).invoke().method("finalize").withoutArgs();
  }
View Full Code Here

  @Test
  public void shouldDeserializeFromGenericTypeOneParam() {
    InputStream stream = new ByteArrayInputStream(
        "{'entity':{'name':'Brutus','age':7,'birthday':'06/01/1987'}}".getBytes());
    ResourceClass resourceClass = new DefaultResourceClass(ExtGenericController.class);
    Method method = new Mirror().on(GenericController.class).reflect().method("method").withAnyArgs();
    ResourceMethod resource = new DefaultResourceMethod(resourceClass, method);
    when(provider.parameterNamesFor(resource.getMethod())).thenReturn(new String[] { "entity" });

    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

  @Test
  public void shouldDeserializeFromGenericTypeTwoParams() {
    InputStream stream = new ByteArrayInputStream(
        "{'entity':{'name':'Brutus','age':7,'birthday':'06/01/1987'}, 'param': 'test'}".getBytes());
    ResourceClass resourceClass = new DefaultResourceClass(ExtGenericController.class);
    Method method = new Mirror().on(GenericController.class).reflect().method("anotherMethod").withAnyArgs();
    ResourceMethod resource = new DefaultResourceMethod(resourceClass, method);
    when(provider.parameterNamesFor(resource.getMethod())).thenReturn(new String[] { "entity", "param" });

    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

TOP

Related Classes of net.vidageek.mirror.dsl.Mirror

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.