org.springframework.tests.sample.beans.HasMap Java Examples

The following examples show how to use org.springframework.tests.sample.beans.HasMap. 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: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testMapWithLiteralsAndReferences() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMap");
	assertTrue(hasMap.getMap().size() == 5);
	assertTrue(hasMap.getMap().get("foo").equals(new Integer(10)));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getMap().get("jenny") == jenny);
	assertTrue(hasMap.getMap().get(new Integer(5)).equals("david"));
	assertTrue(hasMap.getMap().get("bar") instanceof Long);
	assertTrue(hasMap.getMap().get("bar").equals(new Long(100)));
	assertTrue(hasMap.getMap().get("baz") instanceof Integer);
	assertTrue(hasMap.getMap().get("baz").equals(new Integer(200)));
}
 
Example #2
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testPopulatedSet() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("set");
	assertTrue(hasMap.getSet().size() == 3);
	assertTrue(hasMap.getSet().contains("bar"));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getSet().contains(jenny));
	assertTrue(hasMap.getSet().contains(null));
	Iterator it = hasMap.getSet().iterator();
	assertEquals("bar", it.next());
	assertEquals(jenny, it.next());
	assertEquals(null, it.next());
}
 
Example #3
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testPopulatedConcurrentSet() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("concurrentSet");
	assertTrue(hasMap.getConcurrentSet().size() == 3);
	assertTrue(hasMap.getConcurrentSet().contains("bar"));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getConcurrentSet().contains(jenny));
	assertTrue(hasMap.getConcurrentSet().contains(null));
}
 
Example #4
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testPopulatedProps() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
	assertTrue(hasMap.getProps().size() == 2);
	assertTrue(hasMap.getProps().get("foo").equals("bar"));
	assertTrue(hasMap.getProps().get("2").equals("TWO"));
}
 
Example #5
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testObjectArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("objectArray");
	assertTrue(hasMap.getObjectArray().length == 2);
	assertTrue(hasMap.getObjectArray()[0].equals("one"));
	assertTrue(hasMap.getObjectArray()[1].equals(this.beanFactory.getBean("jenny")));
}
 
Example #6
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testIntegerArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray");
	assertTrue(hasMap.getIntegerArray().length == 3);
	assertTrue(hasMap.getIntegerArray()[0].intValue() == 0);
	assertTrue(hasMap.getIntegerArray()[1].intValue() == 1);
	assertTrue(hasMap.getIntegerArray()[2].intValue() == 2);
}
 
Example #7
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testClassArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("classArray");
	assertTrue(hasMap.getClassArray().length == 2);
	assertTrue(hasMap.getClassArray()[0].equals(String.class));
	assertTrue(hasMap.getClassArray()[1].equals(Exception.class));
}
 
Example #8
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testClassList() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("classList");
	assertTrue(hasMap.getClassList().size()== 2);
	assertTrue(hasMap.getClassList().get(0).equals(String.class));
	assertTrue(hasMap.getClassList().get(1).equals(Exception.class));
}
 
Example #9
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testProps() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
	assertEquals(2, hasMap.getProps().size());
	assertEquals("bar", hasMap.getProps().getProperty("foo"));
	assertEquals("TWO", hasMap.getProps().getProperty("2"));

	HasMap hasMap2 = (HasMap) this.beanFactory.getBean("propsViaMap");
	assertEquals(2, hasMap2.getProps().size());
	assertEquals("bar", hasMap2.getProps().getProperty("foo"));
	assertEquals("TWO", hasMap2.getProps().getProperty("2"));
}
 
Example #10
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testMapWithLiteralsOnly() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("literalMap");
	assertTrue(hasMap.getMap().size() == 3);
	assertTrue(hasMap.getMap().get("foo").equals("bar"));
	assertTrue(hasMap.getMap().get("fi").equals("fum"));
	assertTrue(hasMap.getMap().get("fa") == null);
}
 
Example #11
Source File: XmlBeanCollectionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testPopulatedIdentityMap() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap");
	assertTrue(hasMap.getIdentityMap().size() == 2);
	HashSet set = new HashSet(hasMap.getIdentityMap().keySet());
	assertTrue(set.contains("foo"));
	assertTrue(set.contains("jenny"));
}
 
Example #12
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testMapWithLiteralsAndPrototypeReferences() throws Exception {
	TestBean jenny = (TestBean) this.beanFactory.getBean("pJenny");
	HasMap hasMap = (HasMap) this.beanFactory.getBean("pMixedMap");
	assertTrue(hasMap.getMap().size() == 2);
	assertTrue(hasMap.getMap().get("foo").equals("bar"));
	assertTrue(hasMap.getMap().get("jenny").toString().equals(jenny.toString()));
	assertTrue("Not same instance", hasMap.getMap().get("jenny") != jenny);

	HasMap hasMap2 = (HasMap) this.beanFactory.getBean("pMixedMap");
	assertTrue(hasMap2.getMap().size() == 2);
	assertTrue(hasMap2.getMap().get("foo").equals("bar"));
	assertTrue(hasMap2.getMap().get("jenny").toString().equals(jenny.toString()));
	assertTrue("Not same instance", hasMap2.getMap().get("jenny") != hasMap.getMap().get("jenny"));
}
 
Example #13
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testPopulatedSet() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("set");
	assertTrue(hasMap.getSet().size() == 3);
	assertTrue(hasMap.getSet().contains("bar"));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getSet().contains(jenny));
	assertTrue(hasMap.getSet().contains(null));
	Iterator it = hasMap.getSet().iterator();
	assertEquals("bar", it.next());
	assertEquals(jenny, it.next());
	assertEquals(null, it.next());
}
 
Example #14
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testPopulatedConcurrentSet() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("concurrentSet");
	assertTrue(hasMap.getConcurrentSet().size() == 3);
	assertTrue(hasMap.getConcurrentSet().contains("bar"));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getConcurrentSet().contains(jenny));
	assertTrue(hasMap.getConcurrentSet().contains(null));
}
 
Example #15
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testPopulatedIdentityMap() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap");
	assertTrue(hasMap.getIdentityMap().size() == 2);
	HashSet set = new HashSet(hasMap.getIdentityMap().keySet());
	assertTrue(set.contains("foo"));
	assertTrue(set.contains("jenny"));
}
 
Example #16
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testPopulatedProps() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
	assertTrue(hasMap.getProps().size() == 2);
	assertTrue(hasMap.getProps().get("foo").equals("bar"));
	assertTrue(hasMap.getProps().get("2").equals("TWO"));
}
 
Example #17
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testObjectArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("objectArray");
	assertTrue(hasMap.getObjectArray().length == 2);
	assertTrue(hasMap.getObjectArray()[0].equals("one"));
	assertTrue(hasMap.getObjectArray()[1].equals(this.beanFactory.getBean("jenny")));
}
 
Example #18
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testClassArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("classArray");
	assertTrue(hasMap.getClassArray().length == 2);
	assertTrue(hasMap.getClassArray()[0].equals(String.class));
	assertTrue(hasMap.getClassArray()[1].equals(Exception.class));
}
 
Example #19
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testIntegerArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray");
	assertTrue(hasMap.getIntegerArray().length == 3);
	assertTrue(hasMap.getIntegerArray()[0].intValue() == 0);
	assertTrue(hasMap.getIntegerArray()[1].intValue() == 1);
	assertTrue(hasMap.getIntegerArray()[2].intValue() == 2);
}
 
Example #20
Source File: XmlBeanCollectionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testProps() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
	assertEquals(2, hasMap.getProps().size());
	assertEquals("bar", hasMap.getProps().getProperty("foo"));
	assertEquals("TWO", hasMap.getProps().getProperty("2"));

	HasMap hasMap2 = (HasMap) this.beanFactory.getBean("propsViaMap");
	assertEquals(2, hasMap2.getProps().size());
	assertEquals("bar", hasMap2.getProps().getProperty("foo"));
	assertEquals("TWO", hasMap2.getProps().getProperty("2"));
}
 
Example #21
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testObjectArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("objectArray");
	assertTrue(hasMap.getObjectArray().length == 2);
	assertTrue(hasMap.getObjectArray()[0].equals("one"));
	assertTrue(hasMap.getObjectArray()[1].equals(this.beanFactory.getBean("jenny")));
}
 
Example #22
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testMapWithLiteralsOnly() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("literalMap");
	assertTrue(hasMap.getMap().size() == 3);
	assertTrue(hasMap.getMap().get("foo").equals("bar"));
	assertTrue(hasMap.getMap().get("fi").equals("fum"));
	assertTrue(hasMap.getMap().get("fa") == null);
}
 
Example #23
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testMapWithLiteralsAndReferences() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMap");
	assertTrue(hasMap.getMap().size() == 5);
	assertTrue(hasMap.getMap().get("foo").equals(new Integer(10)));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getMap().get("jenny") == jenny);
	assertTrue(hasMap.getMap().get(new Integer(5)).equals("david"));
	assertTrue(hasMap.getMap().get("bar") instanceof Long);
	assertTrue(hasMap.getMap().get("bar").equals(new Long(100)));
	assertTrue(hasMap.getMap().get("baz") instanceof Integer);
	assertTrue(hasMap.getMap().get("baz").equals(new Integer(200)));
}
 
Example #24
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testMapWithLiteralsAndPrototypeReferences() throws Exception {
	TestBean jenny = (TestBean) this.beanFactory.getBean("pJenny");
	HasMap hasMap = (HasMap) this.beanFactory.getBean("pMixedMap");
	assertTrue(hasMap.getMap().size() == 2);
	assertTrue(hasMap.getMap().get("foo").equals("bar"));
	assertTrue(hasMap.getMap().get("jenny").toString().equals(jenny.toString()));
	assertTrue("Not same instance", hasMap.getMap().get("jenny") != jenny);

	HasMap hasMap2 = (HasMap) this.beanFactory.getBean("pMixedMap");
	assertTrue(hasMap2.getMap().size() == 2);
	assertTrue(hasMap2.getMap().get("foo").equals("bar"));
	assertTrue(hasMap2.getMap().get("jenny").toString().equals(jenny.toString()));
	assertTrue("Not same instance", hasMap2.getMap().get("jenny") != hasMap.getMap().get("jenny"));
}
 
Example #25
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testPopulatedSet() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("set");
	assertTrue(hasMap.getSet().size() == 3);
	assertTrue(hasMap.getSet().contains("bar"));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getSet().contains(jenny));
	assertTrue(hasMap.getSet().contains(null));
	Iterator it = hasMap.getSet().iterator();
	assertEquals("bar", it.next());
	assertEquals(jenny, it.next());
	assertEquals(null, it.next());
}
 
Example #26
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testPopulatedConcurrentSet() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("concurrentSet");
	assertTrue(hasMap.getConcurrentSet().size() == 3);
	assertTrue(hasMap.getConcurrentSet().contains("bar"));
	TestBean jenny = (TestBean) this.beanFactory.getBean("jenny");
	assertTrue(hasMap.getConcurrentSet().contains(jenny));
	assertTrue(hasMap.getConcurrentSet().contains(null));
}
 
Example #27
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testPopulatedIdentityMap() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap");
	assertTrue(hasMap.getIdentityMap().size() == 2);
	HashSet set = new HashSet(hasMap.getIdentityMap().keySet());
	assertTrue(set.contains("foo"));
	assertTrue(set.contains("jenny"));
}
 
Example #28
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testPopulatedProps() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
	assertTrue(hasMap.getProps().size() == 2);
	assertTrue(hasMap.getProps().get("foo").equals("bar"));
	assertTrue(hasMap.getProps().get("2").equals("TWO"));
}
 
Example #29
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testIntegerArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray");
	assertTrue(hasMap.getIntegerArray().length == 3);
	assertTrue(hasMap.getIntegerArray()[0].intValue() == 0);
	assertTrue(hasMap.getIntegerArray()[1].intValue() == 1);
	assertTrue(hasMap.getIntegerArray()[2].intValue() == 2);
}
 
Example #30
Source File: XmlBeanCollectionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testClassArray() throws Exception {
	HasMap hasMap = (HasMap) this.beanFactory.getBean("classArray");
	assertTrue(hasMap.getClassArray().length == 2);
	assertTrue(hasMap.getClassArray()[0].equals(String.class));
	assertTrue(hasMap.getClassArray()[1].equals(Exception.class));
}