@Test
public void testLoadSourceThrows() throws Exception {

  Mockito.doThrow(new ApiConfigException("error"))
      .when(datastoreSource).loadEndpointClass(serviceContext, endpointClass, config);
  try {
    loader.loadConfiguration(serviceContext, endpointClass);
  } catch (ApiConfigException expected) {
  }
  Mockito.verify(annotationSource).loadEndpointClass(serviceContext, endpointClass, config);
  Mockito.verify(datastoreSource).loadEndpointClass(serviceContext, endpointClass, config);
  Mockito.verifyNoMoreInteractions(annotationSource, datastoreSource);
}