ResourcesLifecycleManager implements ResourcesLifecycleComponent { @Override public void teardown() { ListIterator<ResourcesLifecycleComponent> iterator = mLifecycleComponents.listIterator(mLifecycleComponents.size()); while (iterator.hasPrevious()) { ResourcesLifecycleComponent component = iterator.previous(); component.teardown(); } } ResourcesLifecycleManager(List<ResourcesLifecycleComponent> lifecycleComponents); @Override void setup(Mockspresso mockspresso); @Override void teardown();  }
@Test public void testTeardownOrder() { mResourcesLifecycleManager.teardown(); InOrder inOrder = Mockito.inOrder(mLifecycleComponents.toArray()); for (int i = mLifecycleComponents.size() - 1; i>=0; i--) { inOrder.verify(mLifecycleComponents.get(i)).teardown(); } verifyNoMoreInteractions(mLifecycleComponents.toArray()); }