@Test public void testGetNhinPatientDiscoveryProxyHappy() { try { NhinPatientDiscoveryProxyObjectFactory proxyFactory = new NhinPatientDiscoveryProxyObjectFactory() { @Override protected Log createLogger() { return mockLog; } @Override protected <T extends Object> T getBean(String beanName, Class<T> type) { return type.cast(mockProxy); } // protected ApplicationContext createApplicationContext() // { // return appContext; // } // @Override // protected ApplicationContext getContext() // { // return appContext; // } }; NhinPatientDiscoveryProxy proxy = proxyFactory.getNhinPatientDiscoveryProxy(); assertNotNull("NhinPatientDiscoveryProxy was null", proxy); } catch (Throwable t) { System.out.println( "Error running testGetNhinPatientDiscoveryProxyHappy test: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetNhinPatientDiscoveryProxyHappy test: " + t.getMessage()); } }
@Test public void testGetConfigFileName() { try { final ApplicationContext mockContext = context.mock(ApplicationContext.class); NhinPatientDiscoveryProxyObjectFactory proxyFactory = new NhinPatientDiscoveryProxyObjectFactory() { @Override protected Log createLogger() { return mockLog; } @Override protected String getConfigFileName() { return "TEST_CONFIG_FILE_NAME"; } @Override protected ApplicationContext getContext() { return mockContext; } }; assertEquals("Config file name", "TEST_CONFIG_FILE_NAME", proxyFactory.getConfigFileName()); } catch (Throwable t) { System.out.println("Error running testGetConfigFileName test: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetConfigFileName test: " + t.getMessage()); } }