ProxyingDiscoveryService { @ApiMethod( name = "apis.list", path = "apis" ) public DirectoryList getApiList(HttpServletRequest request) throws InternalServerErrorException { checkIsInitialized(); return discoveryProvider.getDirectory(getActualRoot(request)); }  @ApiMethod(ignored = AnnotationBoolean.TRUE) synchronized void initialize(DiscoveryProvider discoveryProvider); @ApiMethod( name = "apis.getRest", path = "apis/{api}/{version}/rest" ) RestDescription getRestDocument(HttpServletRequest request, @Named("api") String name,
      @Named("version") String version); @ApiMethod( name = "apis.getRpc", path = "apis/{api}/{version}/rpc" ) RpcDescription getRpcDocument(HttpServletRequest request, @Named("api") String name,
      @Named("version") String version); @ApiMethod( name = "apis.list", path = "apis" ) DirectoryList getApiList(HttpServletRequest request);  }
@Test public void getApiList() throws Exception { ProxyingDiscoveryService discoveryService = createDiscoveryService(true); when(provider.getDirectory(SERVER_ROOT)).thenReturn(DIRECTORY); DirectoryList actual = discoveryService.getApiList(createRequest("discovery/v1/apis")); assertThat(actual).isEqualTo(DIRECTORY); }
@Test public void getApiList_internalServerError() throws Exception { ProxyingDiscoveryService discoveryService = createDiscoveryService(true); when(provider.getDirectory(SERVER_ROOT)) .thenThrow(new InternalServerErrorException("")); try { discoveryService.getApiList(createRequest("discovery/v1/apis")); fail("expected InternalServerErrorException"); } catch (InternalServerErrorException e) { } }
@Test public void getApiList_uninitialized() throws Exception { try { ProxyingDiscoveryService discoveryService = createDiscoveryService(false); discoveryService.getApiList(null ); fail("expected InternalServerErrorException"); } catch (InternalServerErrorException e) { } }