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

The following examples show how to use org.springframework.tests.sample.beans.DummyBean. 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: SimpleConstructorNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void simpleValue() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	String name = "simple";
	//		beanFactory.getBean("simple1", DummyBean.class);
	DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
	assertEquals("simple", nameValue.getValue());
}
 
Example #2
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void simpleRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	String name = "simple-ref";
	//		beanFactory.getBean("name-value1", TestBean.class);
	DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
	assertEquals(beanFactory.getBean("name"), nameValue.getValue());
}
 
Example #3
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void typeIndexedValue() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean typeRef = beanFactory.getBean("indexed-value", DummyBean.class);

	assertEquals("at", typeRef.getName());
	assertEquals("austria", typeRef.getValue());
	assertEquals(10, typeRef.getAge());
}
 
Example #4
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void typeIndexedRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean typeRef = beanFactory.getBean("indexed-ref", DummyBean.class);

	assertEquals("some-name", typeRef.getName());
	assertEquals(beanFactory.getBean("name-value"), typeRef.getSpouse());
}
 
Example #5
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void constructorWithNameEndingInRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean derivedBean = beanFactory.getBean("beanWithRefConstructorArg", DummyBean.class);
	assertEquals(10, derivedBean.getAge());
	assertEquals("silly name", derivedBean.getName());
}
 
Example #6
Source File: SimpleConstructorNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void simpleValue() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	String name = "simple";
	//		beanFactory.getBean("simple1", DummyBean.class);
	DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
	assertEquals("simple", nameValue.getValue());
}
 
Example #7
Source File: SimpleConstructorNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void simpleRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	String name = "simple-ref";
	//		beanFactory.getBean("name-value1", TestBean.class);
	DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
	assertEquals(beanFactory.getBean("name"), nameValue.getValue());
}
 
Example #8
Source File: SimpleConstructorNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void typeIndexedValue() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean typeRef = beanFactory.getBean("indexed-value", DummyBean.class);

	assertEquals("at", typeRef.getName());
	assertEquals("austria", typeRef.getValue());
	assertEquals(10, typeRef.getAge());
}
 
Example #9
Source File: SimpleConstructorNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void typeIndexedRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean typeRef = beanFactory.getBean("indexed-ref", DummyBean.class);

	assertEquals("some-name", typeRef.getName());
	assertEquals(beanFactory.getBean("name-value"), typeRef.getSpouse());
}
 
Example #10
Source File: SimpleConstructorNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void constructorWithNameEndingInRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean derivedBean = beanFactory.getBean("beanWithRefConstructorArg", DummyBean.class);
	assertEquals(10, derivedBean.getAge());
	assertEquals("silly name", derivedBean.getName());
}
 
Example #11
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void simpleValue() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	String name = "simple";
	//		beanFactory.getBean("simple1", DummyBean.class);
	DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
	assertEquals("simple", nameValue.getValue());
}
 
Example #12
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void simpleRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	String name = "simple-ref";
	//		beanFactory.getBean("name-value1", TestBean.class);
	DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
	assertEquals(beanFactory.getBean("name"), nameValue.getValue());
}
 
Example #13
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void typeIndexedValue() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean typeRef = beanFactory.getBean("indexed-value", DummyBean.class);

	assertEquals("at", typeRef.getName());
	assertEquals("austria", typeRef.getValue());
	assertEquals(10, typeRef.getAge());
}
 
Example #14
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void typeIndexedRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean typeRef = beanFactory.getBean("indexed-ref", DummyBean.class);

	assertEquals("some-name", typeRef.getName());
	assertEquals(beanFactory.getBean("name-value"), typeRef.getSpouse());
}
 
Example #15
Source File: SimpleConstructorNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void constructorWithNameEndingInRef() throws Exception {
	DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
	DummyBean derivedBean = beanFactory.getBean("beanWithRefConstructorArg", DummyBean.class);
	assertEquals(10, derivedBean.getAge());
	assertEquals("silly name", derivedBean.getName());
}