ProviderStack { public boolean removeProvider(final int position) { boolean removed = false; try { this.providers.remove(position); removed = true; } catch (IndexOutOfBoundsException e) { removed = false; } refresh(); return removed; } 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 testRemoveProvider() { 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()); providers.removeProvider(1); assertEquals(3, providers.size()); List<Provider> l = providers.getProviders(); assertEquals("aaa", l.get(0).getPrefix()); assertEquals("ccc", l.get(1).getPrefix()); assertEquals("ddd", l.get(2).getPrefix()); providers.removeProvider(5); l = null; providers.clear(); providers = null; }