Package org.springframework.tests.sample.beans

Examples of org.springframework.tests.sample.beans.GenericIntegerBean


    assertEquals(new Long(10), holder.getDerivedIndexedMap().values().iterator().next().get(0));
  }

  @Test
  public void testGenericallyTypedIntegerBean() throws Exception {
    GenericIntegerBean gb = new GenericIntegerBean();
    BeanWrapper bw = new BeanWrapperImpl(gb);
    bw.setPropertyValue("genericProperty", "10");
    bw.setPropertyValue("genericListProperty", new String[] {"20", "30"});
    assertEquals(new Integer(10), gb.getGenericProperty());
    assertEquals(new Integer(20), gb.getGenericListProperty().get(0));
    assertEquals(new Integer(30), gb.getGenericListProperty().get(1));
  }
View Full Code Here


    bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));

    RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class);
    rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    bf.registerBeanDefinition("genericBean", rbd);
    GenericIntegerBean gb = (GenericIntegerBean) bf.getBean("genericBean");

    assertEquals(new UrlResource("http://localhost:8080"), gb.getResourceList().get(0));
    assertEquals(new UrlResource("http://localhost:9090"), gb.getResourceList().get(1));
  }
View Full Code Here

  @Test
  public void testGenericallyTypedIntegerBean() throws Exception {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
        new ClassPathResource("genericBeanTests.xml", getClass()));
    GenericIntegerBean gb = (GenericIntegerBean) bf.getBean("integerBean");
    assertEquals(new Integer(10), gb.getGenericProperty());
    assertEquals(new Integer(20), gb.getGenericListProperty().get(0));
    assertEquals(new Integer(30), gb.getGenericListProperty().get(1));
  }
View Full Code Here

TOP

Related Classes of org.springframework.tests.sample.beans.GenericIntegerBean

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.