NhinPatientDiscoveryProxyObjectFactory extends ComponentProxyObjectFactory { public NhinPatientDiscoveryProxy getNhinPatientDiscoveryProxy() { return getBean(BEAN_NAME_PATIENT_DISCOVERY, NhinPatientDiscoveryProxy.class); }  NhinPatientDiscoveryProxy getNhinPatientDiscoveryProxy();  }
@Test public void testGetNhinPatientDiscoveryProxyHappy() { final ApplicationContext mockContext = context.mock(ApplicationContext.class); NhinPatientDiscoveryProxyObjectFactory proxyFactory = new NhinPatientDiscoveryProxyObjectFactory() { @Override protected ApplicationContext getContext() { return mockContext; } }; context.checking(new Expectations() { { oneOf(mockContext).getBean("nhinpatientdiscovery"); will(returnValue(mockProxy)); } }); NhinPatientDiscoveryProxy actualProxy = proxyFactory.getNhinPatientDiscoveryProxy(); assertNotNull("NhinPatientDiscoveryProxy was null", actualProxy); assertSame(mockProxy, actualProxy); }