Package net.sf.beanrunner.factory

Examples of net.sf.beanrunner.factory.InstanceFactory


   *            the property type
   * @param value
   *            the value to pass
   */
  public void addTestValue(Class type, Object value) {
    InstanceFactory factory = (InstanceFactory) factoryMap.get(type);
    if (factory == null) {
      factoryMap.put(type, new SingleValueInstanceFactory(value));

    } else {
      factoryMap.put(type, new ChainedInstanceFactory(factory, new SingleValueInstanceFactory(value)));
View Full Code Here


  }

  private void simplePropertyTest(Object bean, PropertyDescriptor descriptor, Method readMethod, Method writeMethod)
      throws Exception {
    Class propertyType = descriptor.getPropertyType();
    InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
    if (instances == null) {
      instances = new NestedBeanInstanceFactory(propertyType);
    }
    Object obj;
    Object invoke;
    for (Iterator it = instances.iterator(); it.hasNext(); Assert.assertEquals("Property:" + descriptor.getDisplayName(), obj,
        invoke)) {
      obj = it.next();
      writeMethod.invoke(bean, new Object[] { obj });
      invoke = readMethod.invoke(bean, new Object[0]);
    }
View Full Code Here

     *            the property type
     * @param value
     *            the value to pass
     */
    public void addTestValue(Class type, Object value) {
        InstanceFactory factory = (InstanceFactory) factoryMap.get(type);
        if (factory == null) {
            factoryMap.put(type, new SingleValueInstanceFactory(value));

        } else {
            factoryMap.put(type, new ChainedInstanceFactory(factory, new SingleValueInstanceFactory(value)));
View Full Code Here

    }

    private void testToStringInternal(Object bean, PropertyDescriptor descriptor, Method writeMethod) throws Exception {
        Class propertyType = descriptor.getPropertyType();
        InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
        if (instances == null) {
            instances = new NestedBeanInstanceFactory(propertyType);
        }
        Object obj = null;
        String invoke;
        try {
            for (Iterator it = instances.iterator(); it.hasNext();) {
                obj = it.next();
                writeMethod.invoke(bean, new Object[] { obj });
                invoke = bean.toString();
                String expected = (obj == null) ? "null" : obj.toString();
                String message = "Property not in toString[:" + invoke + "] \nExpected{{"  + expected + " }} "+ descriptor.getDisplayName();
View Full Code Here

    }

    private void simplePropertyTest(Object bean, PropertyDescriptor descriptor, Method readMethod, Method writeMethod)
            throws Exception {
        Class propertyType = descriptor.getPropertyType();
        InstanceFactory instances = (InstanceFactory) factoryMap.get(propertyType);
        if (instances == null) {
            instances = new NestedBeanInstanceFactory(propertyType);
        }
        Object obj;
        Object invoke;
        for (Iterator it = instances.iterator(); it.hasNext(); Assert.assertEquals("Property:" + descriptor.getDisplayName(), obj,
                invoke)) {
            obj = it.next();
            try {
                writeMethod.invoke(bean, new Object[] { obj });
                invoke = readMethod.invoke(bean, new Object[0]);
View Full Code Here

TOP

Related Classes of net.sf.beanrunner.factory.InstanceFactory

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.