@Test public void get_if_exists_when_it_does_exist() { String strategyName = "ethereal"; ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy(); ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource(); Class asoClass = ReadOnlyBean.class; ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator(); ReadOnlyBean aso = new ReadOnlyBean(); Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass, new ApplicationStateContribution(strategyName, creator)); train_get(source, strategyName, strategy); train_getIfExists(strategy, asoClass, aso); replay(); ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null); assertSame(manager.getIfExists(asoClass), aso); verify(); }
public <T> T getIfExists(Class<T> ssoClass) { return getAdapter(ssoClass).getIfExists(); }
ApplicationStateManagerImpl implements ApplicationStateManager { public <T> T getIfExists(Class<T> ssoClass) { return getAdapter(ssoClass).getIfExists(); } }
ApplicationStateManagerImpl implements ApplicationStateManager { public <T> T getIfExists(Class<T> ssoClass) { return getAdapter(ssoClass).getIfExists(); } @SuppressWarnings("unchecked")  ApplicationStateManagerImpl(Map<Class, ApplicationStateContribution> configuration,
            ApplicationStatePersistenceStrategySource source, ObjectLocator locator); }
ApplicationStateManagerImpl implements ApplicationStateManager { public <T> T getIfExists(Class<T> ssoClass) { return getAdapter(ssoClass).getIfExists(); } @SuppressWarnings("unchecked")  ApplicationStateManagerImpl(Map<Class, ApplicationStateContribution> configuration,
            ApplicationStatePersistenceStrategySource source, ObjectLocator locator); T get(Class<T> ssoClass); T getIfExists(Class<T> ssoClass); void set(Class<T> ssoClass, T sso); boolean exists(Class<T> ssoClass); }
ApplicationStateManagerImpl implements ApplicationStateManager { public <T> T getIfExists(Class<T> ssoClass) { return getAdapter(ssoClass).getIfExists(); } @SuppressWarnings("unchecked")  ApplicationStateManagerImpl(Map<Class, ApplicationStateContribution> configuration,
            ApplicationStatePersistenceStrategySource source, ObjectLocator locator); T get(Class<T> ssoClass); T getIfExists(Class<T> ssoClass); void set(Class<T> ssoClass, T sso); boolean exists(Class<T> ssoClass);  }