Java Code Examples for org.springframework.tests.sample.beans.TestBean#getSomeList()

The following examples show how to use org.springframework.tests.sample.beans.TestBean#getSomeList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UtilNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testNestedShortcutCollections() {
	TestBean bean = (TestBean) this.beanFactory.getBean("nestedShortcutCollections");

	assertEquals(1, bean.getStringArray().length);
	assertEquals("fooStr", bean.getStringArray()[0]);

	List list = bean.getSomeList();
	assertEquals(1, list.size());
	assertEquals("foo", list.get(0));

	Set set = bean.getSomeSet();
	assertEquals(1, set.size());
	assertTrue(set.contains("bar"));

	TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedShortcutCollections");
	assertTrue(Arrays.equals(bean.getStringArray(), bean2.getStringArray()));
	assertFalse(bean.getStringArray() == bean2.getStringArray());
	assertEquals(list, bean2.getSomeList());
	assertEquals(set, bean2.getSomeSet());
	assertFalse(list == bean2.getSomeList());
	assertFalse(set == bean2.getSomeSet());
}
 
Example 2
Source File: UtilNamespaceHandlerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testCircularCollectionBeansStartingWithMap() {
	this.beanFactory.getBean("circularMap");
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");

	List list = bean.getSomeList();
	assertFalse(Proxy.isProxyClass(list.getClass()));
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertFalse(Proxy.isProxyClass(set.getClass()));
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertTrue(Proxy.isProxyClass(map.getClass()));
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 3
Source File: UtilNamespaceHandlerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testCircularCollectionBeansStartingWithSet() {
	this.beanFactory.getBean("circularSet");
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");

	List list = bean.getSomeList();
	assertFalse(Proxy.isProxyClass(list.getClass()));
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertTrue(Proxy.isProxyClass(set.getClass()));
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertFalse(Proxy.isProxyClass(map.getClass()));
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 4
Source File: UtilNamespaceHandlerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testCircularCollectionBeansStartingWithList() {
	this.beanFactory.getBean("circularList");
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");

	List list = bean.getSomeList();
	assertTrue(Proxy.isProxyClass(list.getClass()));
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertFalse(Proxy.isProxyClass(set.getClass()));
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertFalse(Proxy.isProxyClass(map.getClass()));
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 5
Source File: UtilNamespaceHandlerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testCircularCollections() {
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionsBean");

	List list = bean.getSomeList();
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 6
Source File: UtilNamespaceHandlerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testNestedInCollections() {
	TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean");

	List list = bean.getSomeList();
	assertEquals(1, list.size());
	assertEquals(Integer.MIN_VALUE, list.get(0));

	Set set = bean.getSomeSet();
	assertEquals(2, set.size());
	assertTrue(set.contains(Thread.State.NEW));
	assertTrue(set.contains(Thread.State.RUNNABLE));

	Map map = bean.getSomeMap();
	assertEquals(1, map.size());
	assertEquals(CustomEnum.VALUE_1, map.get("min"));

	TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedCustomTagBean");
	assertEquals(list, bean2.getSomeList());
	assertEquals(set, bean2.getSomeSet());
	assertEquals(map, bean2.getSomeMap());
	assertFalse(list == bean2.getSomeList());
	assertFalse(set == bean2.getSomeSet());
	assertFalse(map == bean2.getSomeMap());
}
 
Example 7
Source File: UtilNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testNestedInCollections() {
	TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean");

	List list = bean.getSomeList();
	assertEquals(1, list.size());
	assertEquals(Integer.MIN_VALUE, list.get(0));

	Set set = bean.getSomeSet();
	assertEquals(2, set.size());
	assertTrue(set.contains(Thread.State.NEW));
	assertTrue(set.contains(Thread.State.RUNNABLE));

	Map map = bean.getSomeMap();
	assertEquals(1, map.size());
	assertEquals(CustomEnum.VALUE_1, map.get("min"));

	TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedCustomTagBean");
	assertEquals(list, bean2.getSomeList());
	assertEquals(set, bean2.getSomeSet());
	assertEquals(map, bean2.getSomeMap());
	assertFalse(list == bean2.getSomeList());
	assertFalse(set == bean2.getSomeSet());
	assertFalse(map == bean2.getSomeMap());
}
 
Example 8
Source File: UtilNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testCircularCollectionBeansStartingWithList() {
	this.beanFactory.getBean("circularList");
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");

	List list = bean.getSomeList();
	assertTrue(Proxy.isProxyClass(list.getClass()));
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertFalse(Proxy.isProxyClass(set.getClass()));
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertFalse(Proxy.isProxyClass(map.getClass()));
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 9
Source File: UtilNamespaceHandlerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testCircularCollectionBeansStartingWithSet() {
	this.beanFactory.getBean("circularSet");
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");

	List list = bean.getSomeList();
	assertFalse(Proxy.isProxyClass(list.getClass()));
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertTrue(Proxy.isProxyClass(set.getClass()));
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertFalse(Proxy.isProxyClass(map.getClass()));
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 10
Source File: UtilNamespaceHandlerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testCircularCollectionBeansStartingWithList() {
	this.beanFactory.getBean("circularList");
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");

	List list = bean.getSomeList();
	assertTrue(Proxy.isProxyClass(list.getClass()));
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertFalse(Proxy.isProxyClass(set.getClass()));
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertFalse(Proxy.isProxyClass(map.getClass()));
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 11
Source File: UtilNamespaceHandlerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testCircularCollections() {
	TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionsBean");

	List list = bean.getSomeList();
	assertEquals(1, list.size());
	assertEquals(bean, list.get(0));

	Set set = bean.getSomeSet();
	assertEquals(1, set.size());
	assertTrue(set.contains(bean));

	Map map = bean.getSomeMap();
	assertEquals(1, map.size());
	assertEquals(bean, map.get("foo"));
}
 
Example 12
Source File: CollectionMergingTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void mergeList() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithList");
	List list = bean.getSomeList();
	assertEquals("Incorrect size", 3, list.size());
	assertEquals("Rob Harrop", list.get(0));
	assertEquals("Rod Johnson", list.get(1));
	assertEquals("Juergen Hoeller", list.get(2));
}
 
Example 13
Source File: CollectionMergingTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void mergeListWithInnerBeanAsListElement() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithListOfRefs");
	List list = bean.getSomeList();
	assertNotNull(list);
	assertEquals(3, list.size());
	assertNotNull(list.get(2));
	assertTrue(list.get(2) instanceof TestBean);
}
 
Example 14
Source File: CollectionMergingTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void mergeListInConstructor() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithListInConstructor");
	List list = bean.getSomeList();
	assertEquals("Incorrect size", 3, list.size());
	assertEquals("Rob Harrop", list.get(0));
	assertEquals("Rod Johnson", list.get(1));
	assertEquals("Juergen Hoeller", list.get(2));
}
 
Example 15
Source File: CollectionsWithDefaultTypesTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testListHasDefaultType() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
	for (Object o : bean.getSomeList()) {
		assertEquals("Value type is incorrect", Integer.class, o.getClass());
	}
}
 
Example 16
Source File: CollectionMergingTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void mergeListInConstructor() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithListInConstructor");
	List list = bean.getSomeList();
	assertEquals("Incorrect size", 3, list.size());
	assertEquals(list.get(0), "Rob Harrop");
	assertEquals(list.get(1), "Rod Johnson");
	assertEquals(list.get(2), "Juergen Hoeller");
}
 
Example 17
Source File: CollectionMergingTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void mergeList() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithList");
	List list = bean.getSomeList();
	assertEquals("Incorrect size", 3, list.size());
	assertEquals("Rob Harrop", list.get(0));
	assertEquals("Rod Johnson", list.get(1));
	assertEquals("Juergen Hoeller", list.get(2));
}
 
Example 18
Source File: CollectionMergingTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void mergeListWithInnerBeanAsListElement() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithListOfRefs");
	List list = bean.getSomeList();
	assertNotNull(list);
	assertEquals(3, list.size());
	assertNotNull(list.get(2));
	assertTrue(list.get(2) instanceof TestBean);
}
 
Example 19
Source File: CollectionMergingTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void mergeListInConstructor() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithListInConstructor");
	List list = bean.getSomeList();
	assertEquals("Incorrect size", 3, list.size());
	assertEquals("Rob Harrop", list.get(0));
	assertEquals("Rod Johnson", list.get(1));
	assertEquals("Juergen Hoeller", list.get(2));
}
 
Example 20
Source File: CollectionMergingTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void mergeListWithInnerBeanAsListElementInConstructor() throws Exception {
	TestBean bean = (TestBean) this.beanFactory.getBean("childWithListOfRefsInConstructor");
	List list = bean.getSomeList();
	assertNotNull(list);
	assertEquals(3, list.size());
	assertNotNull(list.get(2));
	assertTrue(list.get(2) instanceof TestBean);
}