when(testDataStore.getNames()).thenThrow(new IOException());
when(testDataStore.getTypeNames()).thenThrow(new RuntimeException());
when(testDataStore.getSchema(anyString())).thenThrow(new IOException());
final AbstractDataStoreFactory factory = mock(AbstractDataStoreFactory.class);
when(factory.createDataStore(anyMapOf(String.class, Serializable.class))).thenReturn(
testDataStore);
when(factory.canProcess(anyMapOf(String.class, Serializable.class))).thenReturn(true);
return factory;
}