@Test public void testGetBean() throws Exception { MockImplementation1 mockImplementation1 = new MockImplementation1(); SimpleAppContext appContext = new SimpleAppContext(mockImplementation1); assertEquals(mockImplementation1, appContext.getBean(MockImplementation1.class)); assertEquals(mockImplementation1, appContext.getBean(MockAbstractClass1.class)); assertEquals(mockImplementation1, appContext.getBean(MockInterface1.class)); assertEquals(mockImplementation1, appContext.getBean(MockInterface2.class)); }
@Override public <T> T getBean(Class<T> beanClass) { return getBean(beanClass, DEFAULT_BEAN); }
SimpleAppContext implements AppContext { @Override public <T> T getBean(Class<T> beanClass) { return getBean(beanClass, DEFAULT_BEAN); } }
SimpleAppContext implements AppContext { @Override public <T> T getBean(Class<T> beanClass) { return getBean(beanClass, DEFAULT_BEAN); } SimpleAppContext(AppProperties appProperties);  SimpleAppContext(Object... objects); }
SimpleAppContext implements AppContext { @Override public <T> T getBean(Class<T> beanClass) { return getBean(beanClass, DEFAULT_BEAN); } SimpleAppContext(AppProperties appProperties);  SimpleAppContext(Object... objects); void addBean(Object bean); void addBean(Object bean, String beanName); @Override T getBean(Class<T> beanClass); @SuppressWarnings("unchecked") @Override T getBean(Class<T> beanClass, String beanName); @SuppressWarnings("unchecked") @Override T getBean(String propertyName, Class<T> knownAlternative); }
SimpleAppContext implements AppContext { @Override public <T> T getBean(Class<T> beanClass) { return getBean(beanClass, DEFAULT_BEAN); } SimpleAppContext(AppProperties appProperties);  SimpleAppContext(Object... objects); void addBean(Object bean); void addBean(Object bean, String beanName); @Override T getBean(Class<T> beanClass); @SuppressWarnings("unchecked") @Override T getBean(Class<T> beanClass, String beanName); @SuppressWarnings("unchecked") @Override T getBean(String propertyName, Class<T> knownAlternative);  }