Java Code Examples for org.springframework.tests.sample.beans.TestBean#getSomeSet()
The following examples show how to use
org.springframework.tests.sample.beans.TestBean#getSomeSet() .
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 java-technology-stack with MIT License | 6 votes |
@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 2
Source File: UtilNamespaceHandlerTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@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 3
Source File: UtilNamespaceHandlerTests.java From spring-analysis-note with MIT License | 6 votes |
@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 4
Source File: UtilNamespaceHandlerTests.java From java-technology-stack with MIT License | 6 votes |
@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 spring-analysis-note with MIT License | 6 votes |
@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 6
Source File: UtilNamespaceHandlerTests.java From spring-analysis-note with MIT License | 6 votes |
@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 7
Source File: UtilNamespaceHandlerTests.java From spring-analysis-note with MIT License | 6 votes |
@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 8
Source File: UtilNamespaceHandlerTests.java From java-technology-stack with MIT License | 6 votes |
@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 9
Source File: UtilNamespaceHandlerTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@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 java-technology-stack with MIT License | 6 votes |
@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 11
Source File: CollectionMergingTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void mergeSetWithInnerBeanAsSetElementInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetOfRefsInConstructor"); Set set = bean.getSomeSet(); assertNotNull(set); assertEquals(2, set.size()); Iterator it = set.iterator(); it.next(); Object o = it.next(); assertNotNull(o); assertTrue(o instanceof TestBean); assertEquals("Sally", ((TestBean) o).getName()); }
Example 12
Source File: CollectionMergingTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void mergeSetInConstructor() { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetInConstructor"); Set set = bean.getSomeSet(); assertEquals("Incorrect size", 2, set.size()); assertTrue(set.contains("Rob Harrop")); assertTrue(set.contains("Sally Greenwood")); }
Example 13
Source File: CollectionsWithDefaultTypesTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testSetHasDefaultType() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("testBean"); for (Object o : bean.getSomeSet()) { assertEquals("Value type is incorrect", Integer.class, o.getClass()); } }
Example 14
Source File: CollectionMergingTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void mergeSetWithInnerBeanAsSetElementInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetOfRefsInConstructor"); Set set = bean.getSomeSet(); assertNotNull(set); assertEquals(2, set.size()); Iterator it = set.iterator(); it.next(); Object o = it.next(); assertNotNull(o); assertTrue(o instanceof TestBean); assertEquals("Sally", ((TestBean) o).getName()); }
Example 15
Source File: CollectionsWithDefaultTypesTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testSetHasDefaultType() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("testBean"); for (Object o : bean.getSomeSet()) { 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 |
@Test public void mergeSet() { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSet"); Set set = bean.getSomeSet(); assertEquals("Incorrect size", 2, set.size()); assertTrue(set.contains("Rob Harrop")); assertTrue(set.contains("Sally Greenwood")); }
Example 17
Source File: CollectionMergingTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void mergeSet() { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSet"); Set set = bean.getSomeSet(); assertEquals("Incorrect size", 2, set.size()); assertTrue(set.contains("Rob Harrop")); assertTrue(set.contains("Sally Greenwood")); }
Example 18
Source File: UtilNamespaceHandlerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testNestedCollections() { TestBean bean = (TestBean) this.beanFactory.getBean("nestedCollectionsBean"); 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")); Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertTrue(map.get("foo") instanceof Set); Set innerSet = (Set) map.get("foo"); assertEquals(1, innerSet.size()); assertTrue(innerSet.contains("bar")); TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedCollectionsBean"); 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 19
Source File: CollectionMergingTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void mergeSetWithInnerBeanAsSetElementInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetOfRefsInConstructor"); Set set = bean.getSomeSet(); assertNotNull(set); assertEquals(2, set.size()); Iterator it = set.iterator(); it.next(); Object o = it.next(); assertNotNull(o); assertTrue(o instanceof TestBean); assertEquals("Sally", ((TestBean) o).getName()); }
Example 20
Source File: CollectionMergingTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void mergeSetWithInnerBeanAsSetElement() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetOfRefs"); Set set = bean.getSomeSet(); assertNotNull(set); assertEquals(2, set.size()); Iterator it = set.iterator(); it.next(); Object o = it.next(); assertNotNull(o); assertTrue(o instanceof TestBean); assertEquals("Sally", ((TestBean) o).getName()); }