### Question:
FusionIndexProvider extends IndexProvider { @Override public InternalIndexState getInitialState( StoreIndexDescriptor descriptor ) { Iterable<InternalIndexState> statesIterable = providers.transform( p -> p.getInitialState( descriptor ) ); List<InternalIndexState> states = Iterables.asList( statesIterable ); if ( states.contains( FAILED ) ) { return FAILED; } if ( states.contains( POPULATING ) ) { return POPULATING; } return InternalIndexState.ONLINE; } FusionIndexProvider(
            // good to be strict with specific providers here since this is dev facing
            IndexProvider stringProvider,
            IndexProvider numberProvider,
            IndexProvider spatialProvider,
            IndexProvider temporalProvider,
            IndexProvider luceneProvider,
            SlotSelector slotSelector,
            IndexProviderDescriptor descriptor,
            IndexDirectoryStructure.Factory directoryStructure,
            FileSystemAbstraction fs,
            boolean archiveFailedIndex ); @Override IndexPopulator getPopulator( StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory ); @Override IndexAccessor getOnlineAccessor( StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig ); @Override String getPopulationFailure( StoreIndexDescriptor descriptor ); @Override InternalIndexState getInitialState( StoreIndexDescriptor descriptor ); @Override IndexCapability getCapability( StoreIndexDescriptor descriptor ); @Override StoreMigrationParticipant storeMigrationParticipant( FileSystemAbstraction fs, PageCache pageCache );  }### Answer:
@Test public void shouldReportFailedIfAnyIsFailed() { IndexProvider provider = fusionIndexProvider; for ( InternalIndexState state : InternalIndexState.values() ) { for ( IndexProvider failedProvider : aliveProviders ) { for ( IndexProvider aliveProvider : aliveProviders ) { setInitialState( aliveProvider, failedProvider == aliveProvider ? InternalIndexState.FAILED : state ); } InternalIndexState initialState = provider.getInitialState( AN_INDEX ); assertEquals( InternalIndexState.FAILED, initialState ); } } }
@Test public void shouldReportPopulatingIfAnyIsPopulating() { for ( InternalIndexState state : array( InternalIndexState.ONLINE, InternalIndexState.POPULATING ) ) { for ( IndexProvider populatingProvider : aliveProviders ) { for ( IndexProvider aliveProvider : aliveProviders ) { setInitialState( aliveProvider, populatingProvider == aliveProvider ? InternalIndexState.POPULATING : state ); } InternalIndexState initialState = fusionIndexProvider.getInitialState( AN_INDEX ); assertEquals( InternalIndexState.POPULATING, initialState ); } } }