public void get_from_unconfigured_aso()
{
ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource();
Class asoClass = ReadOnlyBean.class;
final Holder holder = new Holder();
ObjectLocator locator = mockObjectLocator();
train_get(source, ApplicationStateManagerImpl.DEFAULT_STRATEGY, strategy);
IAnswer answer = new IAnswer()
{
public Object answer() throws Throwable
{
ApplicationStateCreator creator = (ApplicationStateCreator) EasyMock
.getCurrentArguments()[1];
Object aso = creator.create();
holder.put(aso);
return aso;
}
};
expect(strategy.get(eq(asoClass), isA(ApplicationStateCreator.class))).andAnswer(answer);
train_autobuild(locator, asoClass, new ReadOnlyBean());
replay();
Map<Class, ApplicationStateContribution> configuration = Collections.emptyMap();
ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, locator);
Object actual = manager.get(asoClass);
assertSame(actual, holder.get());
verify();
}