ApiConfigLoader { public ApiConfig loadConfiguration(ServiceContext serviceContext, Class<?> endpointClass) throws ApiConfigException { ApiConfig config = configFactory.create(serviceContext, typeLoader, endpointClass); annotationSource.loadEndpointClass(serviceContext, endpointClass, config); for (ApiConfigSource apiConfigSource : apiConfigSources) { apiConfigSource.loadEndpointClass(serviceContext, endpointClass, config); } annotationSource.loadEndpointMethods( serviceContext, endpointClass, config.getApiClassConfig().getMethods()); for (ApiConfigSource apiConfigSource : apiConfigSources) { apiConfigSource.loadEndpointMethods( serviceContext, endpointClass, config.getApiClassConfig().getMethods()); } return config; } ApiConfigLoader(ApiConfig.Factory configFactory, TypeLoader typeLoader,
      ApiConfigAnnotationReader annotationSource, ApiConfigSource... apiConfigSources);  ApiConfigLoader(); ApiConfig loadConfiguration(ServiceContext serviceContext, Class<?> endpointClass); ApiConfig loadInternalConfiguration(ServiceContext serviceContext,
      Class<?> endpointClass); boolean isStaticConfig(ApiConfig config); ApiConfig reloadConfiguration(ServiceContext serviceContext, Class<?> endpointClass,
      ApiConfig oldConfig); static final String INTERNAL_API_NAME; }
@Test public void testLoadSource() throws Exception { assertEquals(config, loader.loadConfiguration(serviceContext, endpointClass)); Mockito.verify(annotationSource).loadEndpointClass(serviceContext, endpointClass, config); Mockito.verify(datastoreSource).loadEndpointClass(serviceContext, endpointClass, config); Mockito.verify(annotationSource).loadEndpointMethods(serviceContext, endpointClass, methodsMap); Mockito.verify(datastoreSource).loadEndpointMethods(serviceContext, endpointClass, methodsMap); }
@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); }