@Test
public void testAddIndexMutations() throws IOException {

  ColumnMutationCache mutationCache = new ColumnMutationCache();
  mutationCache.addMutation(TABLENAME, KEYVALUE);
  mutationCache.addMutation(MAIN_TABLE, new KeyValue(ROW, ANOTHER_FAMILY,
      INDEX_QUALIFIER, Long.MAX_VALUE, Type.Put, VALUE));
  mutationCache.addMutation(MAIN_TABLE, new KeyValue(ROW,
      INDEX_FAMILY, ANOTHER_QUALIFIER, Long.MAX_VALUE, Type.Put, VALUE));
  mutationCache.addMutation(MAIN_TABLE, new KeyValue(ROW,
      INDEX_FAMILY, INDEX_QUALIFIER, Long.MAX_VALUE,
      Type.DeleteColumn, VALUE));
  DefaultIndexer indexer = new DefaultIndexer(conf);
  indexer.addIndexMutations(mutationCache);
  Assert.assertEquals(4, mutationCache.size());
  mutationCache.addMutation(MAIN_TABLE, new KeyValue(ROW,
      INDEX_FAMILY, INDEX_QUALIFIER, Long.MAX_VALUE,
      Type.Put, VALUE));
  indexer.addIndexMutations(mutationCache);
  Assert.assertEquals(5, mutationCache.size());
  ColumnCoordinate columnCoordinate = new ColumnCoordinate(INDEX_TABLE, VALUE,
      IndexMasterObserver.THEMIS_SECONDARY_INDEX_TABLE_FAMILY_BYTES, ROW);
  Pair<Type, byte[]> typeAndValue = mutationCache.getMutation(columnCoordinate);
  Assert.assertNotNull(typeAndValue);
  Assert.assertEquals(Type.Put, typeAndValue.getFirst());
  Assert.assertArrayEquals(HConstants.EMPTY_BYTE_ARRAY, typeAndValue.getSecond());
}