@SuppressWarnings("unchecked")
  @Test
  public void set_configured_aso() {
    String strategyName = "ethereal";
    ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
    ApplicationStatePersistenceStrategySource source =
        mockApplicationStatePersistenceStrategySource();
    Class asoClass = ReadOnlyBean.class;
    Object aso = new ReadOnlyBean();

    Map<Class, ApplicationStateContribution> configuration =
        Collections.singletonMap(asoClass, new ApplicationStateContribution(strategyName));

    train_get(source, strategyName, strategy);

    strategy.set(asoClass, aso);

    replay();

    ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);

    manager.set(asoClass, aso);

    verify();
  }
  @SuppressWarnings("unchecked")
  @Test
  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();
  }