ProviderStack { public T getProvider(final int position) { T provider = null; ProviderHolder<T> holder = getProviderHolder(position); if (holder != null) { provider = holder.getProvider(); } return provider; } ProviderStack();  ProviderStack(ServiceManager serviceManager, Class<T> providerType);  ProviderStack(T[] currentProviders); int addProvider(T provider); boolean removeProvider(final int position); boolean removeProvider(T provider); List<T> getProviders(); List<ProviderHolder<T>> getProviderHolders(); Iterator<T> getIterator(); T getProvider(final int position); ProviderHolder<T> getProviderHolder(final int position); int size(); void clear();  }
@Test public void testGetProvider() { ProviderStack<Provider> providers = new ProviderStack<Provider>(new Provider[] { new UnorderedProvider("ccc"), new UnorderedProvider("ddd"), new OrderedProvider("bbb", 5), new OrderedProvider("aaa", 2) }); assertNotNull(providers.hashCode()); assertNotNull(providers.toString()); assertEquals(4, providers.size()); assertEquals("aaa", providers.getProvider(0).getPrefix()); assertEquals("bbb", providers.getProvider(1).getPrefix()); assertEquals("ccc", providers.getProvider(2).getPrefix()); assertEquals("ddd", providers.getProvider(3).getPrefix()); assertEquals(null, providers.getProvider(4)); assertEquals(null, providers.getProvider(5)); assertEquals(null, providers.getProvider(-1)); providers.clear(); providers = null; }