@Test(expected = RemoteConfigurationException.class) public void testGetInstanceByIdBadRequest() throws Exception { RemoteApiException remoteApiException = new RemoteApiException(BAD_REQUEST.getStatusCode(), "Bad Request"); doThrow(remoteApiException).when(instanceApiClient) .getInstanceById(TOKEN, CONFIGURATION_ID, INSTANCE_ID); remoteIntegrationService.getInstanceById(CONFIGURATION_ID, INSTANCE_ID, USER_ID); }
@Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { try { return instanceApiClient.getInstanceById(authenticationProxy.getSessionToken(userId), configurationId, instanceId); } catch (RemoteApiException e) { checkExceptionCodeForbidden(e); if (e.getCode() == BAD_REQUEST.getStatusCode()) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new RemoteConfigurationException(message, e, solution); } throw getUnknownException(e); } }
RemoteIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { try { return instanceApiClient.getInstanceById(authenticationProxy.getSessionToken(userId), configurationId, instanceId); } catch (RemoteApiException e) { checkExceptionCodeForbidden(e); if (e.getCode() == BAD_REQUEST.getStatusCode()) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new RemoteConfigurationException(message, e, solution); } throw getUnknownException(e); } } }
RemoteIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { try { return instanceApiClient.getInstanceById(authenticationProxy.getSessionToken(userId), configurationId, instanceId); } catch (RemoteApiException e) { checkExceptionCodeForbidden(e); if (e.getCode() == BAD_REQUEST.getStatusCode()) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new RemoteConfigurationException(message, e, solution); } throw getUnknownException(e); } }  }
RemoteIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { try { return instanceApiClient.getInstanceById(authenticationProxy.getSessionToken(userId), configurationId, instanceId); } catch (RemoteApiException e) { checkExceptionCodeForbidden(e); if (e.getCode() == BAD_REQUEST.getStatusCode()) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new RemoteConfigurationException(message, e, solution); } throw getUnknownException(e); } }  @Override @PostConstruct void init(); @Override IntegrationSettings getIntegrationById(String integrationId, String userId); @Override IntegrationSettings getIntegrationByType(String integrationType, String userId); @Override IntegrationSettings save(IntegrationSettings settings, String userId); @Override IntegrationInstance getInstanceById(String configurationId, String instanceId,
      String userId); @Override IntegrationInstance save(IntegrationInstance instance, String userId); }
RemoteIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { try { return instanceApiClient.getInstanceById(authenticationProxy.getSessionToken(userId), configurationId, instanceId); } catch (RemoteApiException e) { checkExceptionCodeForbidden(e); if (e.getCode() == BAD_REQUEST.getStatusCode()) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new RemoteConfigurationException(message, e, solution); } throw getUnknownException(e); } }  @Override @PostConstruct void init(); @Override IntegrationSettings getIntegrationById(String integrationId, String userId); @Override IntegrationSettings getIntegrationByType(String integrationType, String userId); @Override IntegrationSettings save(IntegrationSettings settings, String userId); @Override IntegrationInstance getInstanceById(String configurationId, String instanceId,
      String userId); @Override IntegrationInstance save(IntegrationInstance instance, String userId);  }