Java Code Examples for org.springframework.tests.sample.beans.NestedTestBean#setCompany()

The following examples show how to use org.springframework.tests.sample.beans.NestedTestBean#setCompany() . 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: DelegatingIntroductionInterceptorTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testDelegateReturnsThisIsMassagedToReturnProxy() {
	NestedTestBean target = new NestedTestBean();
	String company = "Interface21";
	target.setCompany(company);
	TestBean delegate = new TestBean() {
		@Override
		public ITestBean getSpouse() {
			return this;
		}
	};
	ProxyFactory pf = new ProxyFactory(target);
	pf.addAdvice(new DelegatingIntroductionInterceptor(delegate));
	INestedTestBean proxy = (INestedTestBean) pf.getProxy();

	assertEquals(company, proxy.getCompany());
	ITestBean introduction = (ITestBean) proxy;
	assertSame("Introduced method returning delegate returns proxy", introduction, introduction.getSpouse());
	assertTrue("Introduced method returning delegate returns proxy", AopUtils.isAopProxy(introduction.getSpouse()));
}
 
Example 2
Source File: DelegatingIntroductionInterceptorTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testDelegateReturnsThisIsMassagedToReturnProxy() {
	NestedTestBean target = new NestedTestBean();
	String company = "Interface21";
	target.setCompany(company);
	TestBean delegate = new TestBean() {
		@Override
		public ITestBean getSpouse() {
			return this;
		}
	};
	ProxyFactory pf = new ProxyFactory(target);
	pf.addAdvice(new DelegatingIntroductionInterceptor(delegate));
	INestedTestBean proxy = (INestedTestBean) pf.getProxy();

	assertEquals(company, proxy.getCompany());
	ITestBean introduction = (ITestBean) proxy;
	assertSame("Introduced method returning delegate returns proxy", introduction, introduction.getSpouse());
	assertTrue("Introduced method returning delegate returns proxy", AopUtils.isAopProxy(introduction.getSpouse()));
}
 
Example 3
Source File: DelegatingIntroductionInterceptorTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testDelegateReturnsThisIsMassagedToReturnProxy() {
	NestedTestBean target = new NestedTestBean();
	String company = "Interface21";
	target.setCompany(company);
	TestBean delegate = new TestBean() {
		@Override
		public ITestBean getSpouse() {
			return this;
		}
	};
	ProxyFactory pf = new ProxyFactory(target);
	pf.addAdvice(new DelegatingIntroductionInterceptor(delegate));
	INestedTestBean proxy = (INestedTestBean) pf.getProxy();

	assertEquals(company, proxy.getCompany());
	ITestBean introduction = (ITestBean) proxy;
	assertSame("Introduced method returning delegate returns proxy", introduction, introduction.getSpouse());
	assertTrue("Introduced method returning delegate returns proxy", AopUtils.isAopProxy(introduction.getSpouse()));
}