Search in sources :

Example 11 with InternalServerErrorException

use of com.google.api.server.spi.response.InternalServerErrorException in project endpoints-java by cloudendpoints.

the class CachingDiscoveryProviderTest method getRpcDocument_internalServerError.

@Test
public void getRpcDocument_internalServerError() throws Exception {
    CachingDiscoveryProvider provider = createNonExpiringProvider();
    when(delegate.getRpcDocument(ROOT, NAME, VERSION)).thenThrow(new InternalServerErrorException(""));
    try {
        provider.getRpcDocument(ROOT, NAME, VERSION);
        fail("expected InternalServerErrorException");
    } catch (InternalServerErrorException e) {
    // expected
    }
}
Also used : InternalServerErrorException(com.google.api.server.spi.response.InternalServerErrorException) Test(org.junit.Test)

Example 12 with InternalServerErrorException

use of com.google.api.server.spi.response.InternalServerErrorException in project endpoints-java by cloudendpoints.

the class ProxyingDiscoveryServiceTest method getApiList_internalServerError.

@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) {
    // expected
    }
}
Also used : InternalServerErrorException(com.google.api.server.spi.response.InternalServerErrorException) Test(org.junit.Test)

Aggregations

InternalServerErrorException (com.google.api.server.spi.response.InternalServerErrorException)12 Test (org.junit.Test)9 IOException (java.io.IOException)4 ApiConfigException (com.google.api.server.spi.config.ApiConfigException)1 ApiMethod (com.google.api.server.spi.config.ApiMethod)1 ApiKey (com.google.api.server.spi.config.model.ApiKey)1 BadRequestException (com.google.api.server.spi.response.BadRequestException)1 ForbiddenException (com.google.api.server.spi.response.ForbiddenException)1 UnauthorizedException (com.google.api.server.spi.response.UnauthorizedException)1 ApiConfigs (com.google.api.services.discovery.model.ApiConfigs)1 DatabaseReference (com.google.firebase.database.DatabaseReference)1 TaskCompletionSource (com.google.firebase.tasks.TaskCompletionSource)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Level (java.util.logging.Level)1