/*
   * Default provider is used even on empty list.
   *
   * Test method for
   * 'org.springmodules.jcr.support.AbstractSessionHolderProviderManager.getSessionProvider(SessionFactory)'
   */
  public void testDefaultSessionProvider() {
    // sanity check
    assertSame(providers, providerManager.getProviders());

    sfCtrl.replay();
    sessCtrl.replay();
    repoCtrl.replay();

    SessionHolderProvider provider = providerManager.getSessionProvider(repo);
    assertSame(GenericSessionHolderProvider.class, provider.getClass());
  }
  /*
   * Make sure that we fallback to default provider
   *
   * Test method for
   * 'org.springmodules.jcr.support.AbstractSessionHolderProviderManager.getSessionProvider(SessionFactory)'
   */
  public void testDifferentSessionProvider() {
    // sanity check

    customProvider =
        new SessionHolderProvider() {

          /**
           * @see org.springmodules.jcr.SessionHolderProvider#acceptsRepository(java.lang.String)
           */
          public boolean acceptsRepository(String repo) {
            return false;
          }

          /**
           * @see org.springmodules.jcr.SessionHolderProvider#createSessionHolder(javax.jcr.Session)
           */
          public SessionHolder createSessionHolder(Session session) {
            return null;
          }
        };
    providers = new ArrayList();
    providers.add(customProvider);

    sfCtrl.replay();
    sessCtrl.replay();
    repoCtrl.replay();

    assertSame(
        GenericSessionHolderProvider.class, providerManager.getSessionProvider(repo).getClass());
  }
  /*
   * Make sure that the approapriate provider is selected Test method for
   * 'org.springmodules.jcr.support.AbstractSessionHolderProviderManager.getSessionProvider(SessionFactory)'
   */
  public void testCustomSessionProvider() {
    // sanity check

    providers = new ArrayList();
    providers.add(customProvider);

    sfCtrl.replay();
    sessCtrl.replay();
    repoCtrl.replay();

    assertSame(customProvider, providerManager.getSessionProvider(repo));
  }