IndexManager { void removeIndexMapping(RegionEntry entry, IndexProtocol index, int opCode) { try { index.removeIndexMapping(entry, opCode); } catch (Exception exception) { index.markValid(false); setPRIndexAsInvalid((AbstractIndex) index); logger.warn(String.format( "Updating the Index %s failed. The index is corrupted and marked as invalid.", ((AbstractIndex) index).indexName), exception); } } IndexManager(InternalCache cache, Region region); static void setIndexBufferTime(long lastModifiedTime, long currentCacheTime); static void resetIndexBufferTime(); static boolean needsRecalculation(long queryStartTime, long lastModifiedTime); Region getRegion(); IndexUpdaterThread getUpdaterThread(); Index createIndex(String indexName, IndexType indexType, String origIndexedExpression,
      String origFromClause, String imports, ExecutionContext externalContext,
      PartitionedIndex prIndex, boolean loadEntries); Index getIndex(String indexName); void addIndex(String indexName, Index index); IndexData getIndex(IndexType indexType, String[] definitions,
      CompiledValue indexedExpression, ExecutionContext context); int compareIndexData(IndexType indexType, String[] indexDefinitions,
      String indexExpression, IndexType otherType, String[] otherDefinitions,
      String otherExpression, int mapping[]); IndexData getBestMatchIndex(IndexType indexType, String[] definitions,
      CompiledValue indexedExpression, ExecutionContext context); Collection getIndexes(IndexType indexType); Collection getIndexes(); void removeIndex(Index index); int removeIndexes(); void rerunIndexCreationQuery(); void populateIndexes(Collection<Index> indexSet); void setPopulateFlagForIndexes(Collection<Index> indexSet); void updateIndexes(RegionEntry entry, int action, int opCode); void updateIndexes(RegionEntry entry, int action, int opCode,
      boolean isDiskRecoveryInProgress); void waitForIndexInit(); void countDownIndexUpdaters(); void destroy(); void removeBucketIndexes(PartitionedRegion prRegion); @Override String toString(); boolean isIndexMaintenanceTypeSynchronous(); boolean isOverFlowRegion(); boolean isOffHeap(); static boolean isObjectModificationInplace(); String putCanonicalizedIteratorNameIfAbsent(String definition); void putCanonicalizedIteratorName(String definition, String name); String getCanonicalizedIteratorName(String definition); static final int ADD_ENTRY; static final int UPDATE_ENTRY; static final int REMOVE_ENTRY; static final int RECREATE_INDEX; static final boolean JOIN_OPTIMIZATION; @MutableForTesting
  static boolean INPLACE_OBJECT_MODIFICATION_FOR_TEST; @MutableForTesting
  static boolean IS_TEST_LDM; @MutableForTesting
  static boolean IS_TEST_EXPANSION; static final boolean INPLACE_OBJECT_MODIFICATION; static final boolean RANGEINDEX_ONLY; @MutableForTesting
  static boolean TEST_RANGEINDEX_ONLY; static final String INDEX_ELEMARRAY_THRESHOLD_PROP; static final String INDEX_ELEMARRAY_SIZE_PROP; static final int INDEX_ELEMARRAY_THRESHOLD; static final int INDEX_ELEMARRAY_SIZE; @MakeNotStatic
  static final AtomicLong SAFE_QUERY_TIME; @MutableForTesting
  static boolean ENABLE_UPDATE_IN_PROGRESS_INDEX_CALCULATION; static final Object NULL; @MutableForTesting
  static TestHook testHook; }
@Test public void removeIndexMappingShouldMarkIndexAsInvalidWhenRemoveMappingOperationFails() throws IMQException { RegionEntry mockEntry = mock(RegionEntry.class); AbstractIndex mockIndex = mock(AbstractIndex.class); mockIndex.prIndex = mock(AbstractIndex.class); when(mockIndex.removeIndexMapping(mockEntry, 1)).thenThrow(new IMQException("Mock Exception")); assertThatCode(() -> indexManager.removeIndexMapping(mockEntry, mockIndex, 1)) .doesNotThrowAnyException(); verify(mockIndex, times(1)).markValid(false); verify((AbstractIndex) mockIndex.prIndex, times(1)).markValid(false); }