Java Code Examples for org.springframework.tests.sample.beans.ITestBean#hashCode()
The following examples show how to use
org.springframework.tests.sample.beans.ITestBean#hashCode() .
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: JndiObjectFactoryBeanTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testLookupWithExposeAccessContext() throws Exception { JndiObjectFactoryBean jof = new JndiObjectFactoryBean(); TestBean tb = new TestBean(); final Context mockCtx = mock(Context.class); given(mockCtx.lookup("foo")).willReturn(tb); jof.setJndiTemplate(new JndiTemplate() { @Override protected Context createInitialContext() { return mockCtx; } }); jof.setJndiName("foo"); jof.setProxyInterface(ITestBean.class); jof.setExposeAccessContext(true); jof.afterPropertiesSet(); assertTrue(jof.getObject() instanceof ITestBean); ITestBean proxy = (ITestBean) jof.getObject(); assertEquals(0, tb.getAge()); proxy.setAge(99); assertEquals(99, tb.getAge()); proxy.equals(proxy); proxy.hashCode(); proxy.toString(); verify(mockCtx, times(2)).close(); }
Example 2
Source File: JndiObjectFactoryBeanTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testLookupWithExposeAccessContext() throws Exception { JndiObjectFactoryBean jof = new JndiObjectFactoryBean(); TestBean tb = new TestBean(); final Context mockCtx = mock(Context.class); given(mockCtx.lookup("foo")).willReturn(tb); jof.setJndiTemplate(new JndiTemplate() { @Override protected Context createInitialContext() { return mockCtx; } }); jof.setJndiName("foo"); jof.setProxyInterface(ITestBean.class); jof.setExposeAccessContext(true); jof.afterPropertiesSet(); assertTrue(jof.getObject() instanceof ITestBean); ITestBean proxy = (ITestBean) jof.getObject(); assertEquals(0, tb.getAge()); proxy.setAge(99); assertEquals(99, tb.getAge()); proxy.equals(proxy); proxy.hashCode(); proxy.toString(); verify(mockCtx, times(2)).close(); }
Example 3
Source File: JndiObjectFactoryBeanTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testLookupWithExposeAccessContext() throws Exception { JndiObjectFactoryBean jof = new JndiObjectFactoryBean(); TestBean tb = new TestBean(); final Context mockCtx = mock(Context.class); given(mockCtx.lookup("foo")).willReturn(tb); jof.setJndiTemplate(new JndiTemplate() { @Override protected Context createInitialContext() { return mockCtx; } }); jof.setJndiName("foo"); jof.setProxyInterface(ITestBean.class); jof.setExposeAccessContext(true); jof.afterPropertiesSet(); assertTrue(jof.getObject() instanceof ITestBean); ITestBean proxy = (ITestBean) jof.getObject(); assertEquals(0, tb.getAge()); proxy.setAge(99); assertEquals(99, tb.getAge()); proxy.equals(proxy); proxy.hashCode(); proxy.toString(); verify(mockCtx, times(2)).close(); }